[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to go back to the branch after mistakenly switching to the trunk

From: Pierre Asselin
Subject: Re: How to go back to the branch after mistakenly switching to the trunk
Date: Mon, 5 Sep 2005 23:42:10 +0000 (UTC)
User-agent: tin/1.6.2-20030910 ("Pabbay") (UNIX) (NetBSD/2.0 (i386))

Ming Kin Lai <address@hidden> wrote:
> I did not read carefully the documentation on "cvs commit -r REV" and made a 
> mistake by committing a revision with a specified REV number on a branch.  
> One cannot commit to a specific revision on a branch - and I did exactly 
> that and now that revision is on the trunk.

> [ ... ]  Specifically, I made a tag on 
> the trunk (let's say at revision 1.1) called "Root-of-Branch" before 
> creating a branch called MyBranch using "cvs tag -b MyBranch".

So far, so good...

> Then I made 
> some changes and tried to call it 2.1 by using "cvs commit -r 2.1".

Not so good.

Here's what I would do.
    0)  Back up the repository.
    1)  Tell everyone to stop committing while you fix the mess.
    2)  Get a branch sandbox.

            cd some/clean/directory
            cvs checkout -r MyBranch MyProject
            cd MyProject

        This gives you a sandbox identical to your starting point
        but with a sticky tag to the branch, which means that
        any changes you commit in that sandbox will go on the branch.

    3)  Merge to that sandbox the work that was supposed to go on the
        branch.  Commit to the branch.

            cvs update -j Root-of-Branch -j 2.1
            cvs commit

    4)  Return to the trunk and remove the 2.1 garbage.

            cvs update -A       # note 1
            cvs update -r1.     # note 2
            cvs admin -o2.1     # note 3
            cvs update -A       # note 4

        note 1:  This clears the sticky tag "MyBranch" and puts you
            back on the trunk, at revision 2.1 everywhere.
        note 2:  This should revert each file to the last revision
            of the form "1.n";  it also plants a sticky tag "1."
            that makes it impossible to commit changes.  You
            could also use "-r Root-of-Branch" instead of "-r1.".
        note 3:  This irreversibly deletes the revisions 2.1 from
            your repository.
        note 4:  This clears the "1." sticky tag and puts you
            back at the tip of the trunk... which is no longer
            2.1 but is rather the same 1.n that each file is on.
            So no change, but your sandbox is now ready for
            more commits on the trunk.

    5)  Give the "all clear".

pa at panix dot com

reply via email to

[Prev in Thread] Current Thread [Next in Thread]