[lug] cvs question

rotering at animalcules.com rotering at animalcules.com
Tue Oct 9 13:24:32 MDT 2001


On Tue, Oct 09, 2001 at 11:11:26AM -0600, Chris Wade wrote:

[Development on (CVS) branch overtakes main trunk]

> At this point I am way past the point of being able to successfully
> merge all of the files back into the trunk, so I am wondering if anyone
> knows of a quick and easy way to split off the current trunk version into a
> separate branch in case I ever get back to it, and re-assign all of the
> branch files to the trunk?

There are two ways that sprint immediately to mind.  Both involve
drastic action, which tells me that there's probably a better way.

The methods are simple and amount to the same thing: get rid of the
files on the trunk and overwrite them with the files on the desired
branch.  The only difference between the two methods is how how you go
about writing the branch files to the main trunk.

***Please note that I have not tried these things.  Follow these
instructions at your own risk.***

Here's algorithm A:

        A0. Check out a copy of the main trunk.

        A1. Tag every file in the main trunk with a regular tag (not a
            branch tag).  Remember to either commit any desired
            changes or use the -c flag when tagging.

        A2. Delete every file below the root directory of your working
            copy.  DO NOT DELETE CVS DIRECTORIES.

            Ex:

                A0.  cvs co foo
                A1.  cd foo; cvs tag OH_MY_GOD_WHAT_HAVE_I_DONE
                A2.  find . | grep -v CVS | xargs rm -rf

        A3. Export the files from the branch of interest into your
            working copy.

                cd ..; cvs export -rTHE_GOOD_FILES foo

        A4. Add any new files and commit.  This should now be your new
            main trunk.

Algorithm B:

        B0. Same as A0.

        B1. Same as A1.

        B2. Delete the files and the remove them from the trunk.

            Ex.

                cd foo
                for file in `find . -type f | grep -v CVS`;
                do
                        rm $file;
                        cvs remove $file
                done

        B3. Commit the removals to the repository.

        B4. Merge your branch into the main trunk.

        B5. Commit the merge.


Algorithm C:

        If you can afford to lose the revision history of the branch
        you can also export it and re-import it as a new module.  This
        is the simplest method, by far.




More information about the LUG mailing list