From: Graham W. <gr...@mk...> - 2004-11-12 19:12:48
|
On Sun, Oct 24, 2004 at 01:38:34PM +0200, Matthias Andree wrote: > OK, I will figure how to branch and merge in Subversion and to that next > time for "sweeping" changes that aren't self-contained in a single > patch-set. It's only that I am not particularly fond of branches as most > of my development efforts are still CVS-based, and CVS's branch handling > is known to be inferior to SVN. Branching and tagging is done by the same operation in Subversion. For example, if I wanted to create Debian branch for fetchmail, I could do the following (this doesn't modify your working copy): $ scp https://decoy.wox.org/svn/fetchmail/trunk \ https://decoy.wox.org/svn/fetchmail/branches/debian \ -m "Create a Debian branch of fetchmail." You can then switch your working copy of fetchmail to the Debian branch by doing the following: $ cd /path/to/my/wc $ svn switch https://decoy.wox.org/svn/fetchmail/branches/debian Switching back to the trunk is just as easy: $ cd /path/to/my/wc $ svn switch https://decoy.wox.org/svn/fetchmail/branches/debian To see what branch your working on current, use the info subcommand in the toplevel of your of your working copy: $ pwd /path/to/my/wc $ svn info Path: . URL: https://decoy.wox.org/svn/fetchmail/trunk Repository UUID: 6bd12b38-53dc-0310-98db-d94f1ca4f90c Revision: 4001 Node Kind: directory Schedule: normal Last Changed Author: m-a Last Changed Rev: 4001 Last Changed Date: 2004-11-10 16:57:00 -0600 (Wed, 10 Nov 2004) Properties Last Updated: 2004-08-08 03:22:17 -0500 (Sun, 08 Aug 2004) You can make checkins on a branch the same way you would on the trunk, as long as the info subcommand shows the branch, not the trunk. Tagging is done the same way as branching, except you copy to the tags directory, not the branhes directory, and you never checkin anything on a tag. The other important operation besides branching is merging. To merge the changes from the branch (make sure you are on the trunk, and not a branch): $ cd /path/to/my/wc $ svn merge https://decoy.wox.org/svn/fetchmail/trunk \ https://decoy.wox.org/svn/fetchmail/branches/debian (Note that this wouldn't make sense for the Debian branch, but this is just an example.) Check the output for any lines that start with C, which means that there was a conflict in the merge. Open the file, and search for the conflict markers, and resolve the conflict. Then do: $ svn resolved conflict.c Then you have to checkin the merged changes the same way you would normally checkin changes. To see what would be merged before doing the merge operation: $ svn diff https://decoy.wox.org/svn/fetchmail/trunk \ https://decoy.wox.org/svn/fetchmail/branches/debian The diff and merge subcommands are pretty similar, except the diff subcommand outputs the differences, while the merge subcommands applies them to your working copy. I'd be happy to answer any questions anyone has (assuming I can, of course :). -- gram |