Demo of automatic merge tracking in Subversion 1.5

Create a Demo Project

I'll create a basic project to demonstrate how the merge-tracking features in Subversion 1.5 work. This isn't exactly new, but it's new to me since our company just upgraded our svn server.

$ svnadmin create frobulator-repo
$ mkdir skeleton
$ mkdir skeleton/trunk
$ touch skeleton/trunk/frob.rb
$ mkdir skeleton/branches
$ mkdir skeleton/branches/release-1.0.0
$ cp skeleton/trunk/frob.rb skeleton/branches/release-1.0.0/
$ svn import skeleton file:///Users/alex/tmp/frobulator-repo -m 'initial import'
Adding         skeleton/trunk
Adding         skeleton/trunk/frob.rb
Adding         skeleton/branches
Adding         skeleton/branches/release-1.0.0
Adding         skeleton/branches/release-1.0.0/frob.rb

Committed revision 1.
$ svn co file:///Users/alex/tmp/frobulator-repo frobulator-wc
A    frobulator-wc/trunk
A    frobulator-wc/trunk/frob.rb
A    frobulator-wc/branches
A    frobulator-wc/branches/release-1.0.0
A    frobulator-wc/branches/release-1.0.0/frob.rb
Checked out revision 1.

Make a Change

So far, I've created a new repository with a trunk and 1 branch. The trunk and branch have identical content right now, a single empty frob.rb file.

I'll fix a 'bug' in the trunk now.

$ cd frobulator-wc/trunk
frobulator-wc/trunk$ echo 'puts "bug fixed!"' > frob.rb
frobulator-wc/trunk$ svn commit -m 'fixed bug in frob.rb'
Sending        trunk/frob.rb
Transmitting file data .
Committed revision 2.

Merge Fix

Now I want to merge my bug fix into my release branch.

frobulator-wc/trunk$ cd ../branches/release-1.0.0/
frobulator-wc/branches/release-1.0.0$ svn merge -c 2 file:///Users/alex/tmp/frobulator-repo/trunk .
--- Merging r2 into '.':
U    frob.rb
frobulator-wc/branches/release-1.0.0$ svn commit -m 'merge bug fix from trunk'
Sending        release-1.0.0
Sending        release-1.0.0/frob.rb
Transmitting file data .
Committed revision 3.

View Basic Log

Up to this point, there's nothing different from how I would have done things in subversion 1.4, except that my commit in the branch didn't mention where the merge came from. Formerly, I would have added a commit log like "merged trunk r2 into release-1.0.0". Otherwise we wouldn't have known what got merged and what didn't.

Notice the log only shows changes which were made in this branch. This behavior is the same as in previous version of Subversion.

frobulator-wc/branches/release-1.0.0$ svn log -v
------------------------------------------------------------------------
r3 | alex | 2010-07-27 09:08:43 -0500 (Tue, 27 Jul 2010) | 1 line
Changed paths:
   M /branches/release-1.0.0
   M /branches/release-1.0.0/frob.rb

merge bug fix from trunk
------------------------------------------------------------------------
r1 | alex | 2010-07-27 09:04:51 -0500 (Tue, 27 Jul 2010) | 1 line
Changed paths:
   A /branches
   A /branches/release-1.0.0
   A /branches/release-1.0.0/frob.rb
   A /trunk
   A /trunk/frob.rb

initial import
------------------------------------------------------------------------

View Merge Information in Log

This is where the new merge-tracking features in Subversion 1.5 show themselves. Adding the -g flag displays revision 2 as being part of release-1.0.0, and adds a note describing when this change was merged into the branch. Pretty nice.

frobulator-wc/branches/release-1.0.0$ svn log -vg
------------------------------------------------------------------------
r3 | alex | 2010-07-27 09:08:43 -0500 (Tue, 27 Jul 2010) | 1 line
Changed paths:
   M /branches/release-1.0.0
   M /branches/release-1.0.0/frob.rb

merge bug fix from trunk
------------------------------------------------------------------------
r2 | alex | 2010-07-27 09:07:15 -0500 (Tue, 27 Jul 2010) | 1 line
Changed paths:
   M /trunk/frob.rb
Merged via: r3

fixed bug in frob.rb
------------------------------------------------------------------------
r1 | alex | 2010-07-27 09:04:51 -0500 (Tue, 27 Jul 2010) | 1 line
Changed paths:
   A /branches
   A /branches/release-1.0.0
   A /branches/release-1.0.0/frob.rb
   A /trunk
   A /trunk/frob.rb

initial import
------------------------------------------------------------------------

I would ne'er have thought that the bookmarking submissions service could help so much in web site optimization. However, that was workable.

Post new comment

The content of this field is kept private and will not be shown publicly.
CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.