How do I revert a big change in CVS?

前端 未结 10 547
离开以前
离开以前 2021-02-01 16:49

One of my colleagues has totally messed up the contents of a directory in our main CVS repository. I need to just revert the whole module to the state it was in at the end of l

10条回答
  •  迷失自我
    2021-02-01 17:15

    Actually your initial approach was very close to the solution. The problem is, that joining date-based does not handle removed files and directories correctly. You need to set a tag to the code base you want to join first:

    mkdir code_base1 && cd code_base1
    cvs co -D "2008-12-30" modulename
    cvs tag code_base_2008_12_30
    

    Now do the join tag-based, subtracting all changes between now and 2008-12-30:

    cd .. && mkdir code_base2 && cd code_base2
    cvs co modulename
    cvs update -d -j HEAD -j code_base_2008_12_30  # use -d to resurrect deleted directories
    

    Compare the contents of code_base1 and code_base2. They should be identical except for the CVS meta information. Finally commit the code as it was on 2008-12-30 as new HEAD:

    cvs commit -m "Revert all changes this year"
    

    Note that tagging the code you wish to join like this will not work, because rtag also does not handle removed files and directories correctly, when using -D:

    cvs rtag -D "2008-12-30" code_base_2008_12_30 modulename
    

提交回复
热议问题