You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Carl Lerche <cl...@tarot.com> on 2007/02/07 20:21:10 UTC

Merging and revision numbers

Hello all,

I had a hopefully simple question. Let's say I have a big project to  
work on, and I create a branch of trunk. The project will take a few  
weeks and I want to also keep the branch up to date with trunk. So,  
every end of day, I merge from trunk into the branch. As far as I  
understand, the command would be something similar to this:

svn merge -r r1:HEAD http://svn.foo.com/project/trunk

where r1 is the last time (the day before) that I integrated from trunk.

My question is this, is there an easier way to keep track of what r1  
is than to go through log messages? It seems that it would be  
somewhat of a pain.

Thanks for any help.

-carl

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Merging and revision numbers

Posted by Thomas Wicklund <wi...@eskimo.com>.
Les Mikesell writes:
 > Thomas Wicklund wrote:
 > 
 > > Finding out what you've changed in a branch is also simple:
 > > 
 > >     svn diff tags/mybranch/base branches/mybranch
 > > 
 > > Using a scheme like this, you almost never need to worry about
 > > revision numbers.  The only time I've dealt with revision numbers
 > > lately is resurrecting a deleted branch (because I haven't had a
 > > reason to automate it).
 > 
 > But your example only deals with a single branch there, and the main 
 > reason for branching would be to isolate simultaneous work on several 
 > branches.  How do you track things between branches or after some or all 
 > of the changes are merged back to the trunk?

My example deals with one branch (mybranch).  For multiple branches
define mybranch2, mybranch3, etc.  By using the branch name in both
the branch and associated tags, each branch is independent.

I currently work with 20 branches on two trunk projects.  Each is
independent, each is based on a different trunk revision, and I can
easily merge to/from the trunk (or between branches if needed).

Thomas Wicklund

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Merging and revision numbers

Posted by Les Mikesell <le...@gmail.com>.
Thomas Wicklund wrote:

> Finding out what you've changed in a branch is also simple:
> 
>     svn diff tags/mybranch/base branches/mybranch
> 
> Using a scheme like this, you almost never need to worry about
> revision numbers.  The only time I've dealt with revision numbers
> lately is resurrecting a deleted branch (because I haven't had a
> reason to automate it).

But your example only deals with a single branch there, and the main 
reason for branching would be to isolate simultaneous work on several 
branches.  How do you track things between branches or after some or all 
of the changes are merged back to the trunk?

-- 
   Les Mikesell
    lesmikesell@gmail.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

Re: Merging and revision numbers

Posted by Thomas Wicklund <wi...@eskimo.com>.
Carl Lerche writes:
 > Hello all,
 > 
 > I had a hopefully simple question. Let's say I have a big project to  
 > work on, and I create a branch of trunk. The project will take a few  
 > weeks and I want to also keep the branch up to date with trunk. So,  
 > every end of day, I merge from trunk into the branch. As far as I  
 > understand, the command would be something similar to this:
 > 
 > svn merge -r r1:HEAD http://svn.foo.com/project/trunk
 > 
 > where r1 is the last time (the day before) that I integrated from trunk.
 > 
 > My question is this, is there an easier way to keep track of what r1  
 > is than to go through log messages? It seems that it would be  
 > somewhat of a pain.
 > 
 > Thanks for any help.
 > 
 > -carl


A basic rule for branches is to tag the code the branch is based on.
The following supports branching (I use scripts which handle the
details cleanly):

Creating branch "mybranch" and checking out to "branch-workspace":

    svn copy trunk tags/mybranch/base
    svn copy tags/mybranch/base branches/mybranch
    svn checkout branches/mybranch branch-workspace

At this point you have a branch plus a tag recording the code the
branch is based off of.


To merge the trunk to the branch (first commit branch changes):

    cd branch-workspace
    svn copy trunk tags/mybranch/new
    svn merge tags/mybranch/base tags/mybranch/new


When you determine the merge is good (so want to commit the result):

    cd branch-workspace
    svn commit -m "Commit merge"
    svn delete tags/mybranch/base
    svn move tags/mybranch/new tags/mybranch/base


This makes "base" the code you're now based on after the commit.

To merge the branch back into the trunk, you now have a simple way to
do the merge.  First commit in all branch changes then do:

    cd trunk-workspace
    svn merge tags/mybranch/base branches/mybranch

You now have a new trunk workspace with your branch changes.

Finding out what you've changed in a branch is also simple:

    svn diff tags/mybranch/base branches/mybranch

Using a scheme like this, you almost never need to worry about
revision numbers.  The only time I've dealt with revision numbers
lately is resurrecting a deleted branch (because I haven't had a
reason to automate it).

I use scripts to automate the above.  One flaw is that a failure in
the middle of a sequence will need to be manually repaired, but that
should be infrequent.  A tool like mucc could make these operations
atomic since mucc performs multiple SVN commit, copy, delete, etc
actions as a single change.



Another approach is used by the tool svnmerge, which uses properties
to track revision numbers and gives you find grained merging between a
branch and trunk.


Thomas Wicklund

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

RE: Merging and revision numbers

Posted by Chris Gummer <ch...@hotmail.com>.
I haven't used it, but I know people who do and they like it.

You may also be interested in:

http://subversion.tigris.org/merge-tracking/

----Original Message Follows----
From: "L. Wayne Johnson" <wa...@zk.com>
To: <us...@subversion.tigris.org>
Subject: RE: Merging and revision numbers
Date: Thu, 8 Feb 2007 12:42:16 -0800



 >> -----Original Message-----
 >> From: Carl Lerche [mailto:clerche@tarot.com]
 >> Sent: Wednesday, February 07, 2007 12:21 PM
 >> To: users@subversion.tigris.org
 >> Subject: Merging and revision numbers
 >>
 >> Hello all,
 >>
 >> I had a hopefully simple question. Let's say I have a big project to
 >> work on, and I create a branch of trunk. The project will take a few
 >> weeks and I want to also keep the branch up to date with trunk. So,
 >> every end of day, I merge from trunk into the branch. As far as I
 >> understand, the command would be something similar to this:
 >>
 >> svn merge -r r1:HEAD http://svn.foo.com/project/trunk
 >>
 >> where r1 is the last time (the day before) that I integrated from trunk.
 >>
 >> My question is this, is there an easier way to keep track of what r1
 >> is than to go through log messages? It seems that it would be
 >> somewhat of a pain.

I've not used it personally but take a look at svnmerge:

http://www.orcaware.com/svn/wiki/Svnmerge.py

I believe that the svn developers are using in on this project.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

_________________________________________________________________
Advertisement: Meet Sexy Singles Today @ Lavalife - Click here  
http://a.ninemsn.com.au/b.aspx?URL=http%3A%2F%2Flavalife9%2Eninemsn%2Ecom%2Eau%2Fclickthru%2Fclickthru%2Eact%3Fid%3Dninemsn%26context%3Dan99%26locale%3Den%5FAU%26a%3D23769&_t=754951090&_r=endtext_lavalife_dec_meet&_m=EXT

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org

RE: Merging and revision numbers

Posted by "L. Wayne Johnson" <wa...@zk.com>.

>> -----Original Message-----
>> From: Carl Lerche [mailto:clerche@tarot.com]
>> Sent: Wednesday, February 07, 2007 12:21 PM
>> To: users@subversion.tigris.org
>> Subject: Merging and revision numbers
>> 
>> Hello all,
>> 
>> I had a hopefully simple question. Let's say I have a big project to
>> work on, and I create a branch of trunk. The project will take a few
>> weeks and I want to also keep the branch up to date with trunk. So,
>> every end of day, I merge from trunk into the branch. As far as I
>> understand, the command would be something similar to this:
>> 
>> svn merge -r r1:HEAD http://svn.foo.com/project/trunk
>> 
>> where r1 is the last time (the day before) that I integrated from trunk.
>> 
>> My question is this, is there an easier way to keep track of what r1
>> is than to go through log messages? It seems that it would be
>> somewhat of a pain.

I've not used it personally but take a look at svnmerge:

http://www.orcaware.com/svn/wiki/Svnmerge.py

I believe that the svn developers are using in on this project.

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@subversion.tigris.org
For additional commands, e-mail: users-help@subversion.tigris.org