Forums » Rails-core » Use svnmerge.py for merging trunk to stable branch

Use svnmerge.py for merging trunk to stable branch
Posted by Blair Zajac (Guest)
on 07.04.2006 21:30
Now that Rails has a stable branch, I would like to suggest considering 
using
svnmerge.py to manage the revisions in trunk that you want to pull over 
into the
branch.  It'll make life much easier in managing commits to trunk and 
then
merging them to stable.

Svnmerge.py makes life easy in migrating commits from one place to 
another, such
as from trunk to branch.  We use this all the time to take revisions on 
a
development trunk and merge them over into release branches.

Svnmerge.py stores into a Subversion property on the branch all the 
revisions
that you have merged over already and allows you to see which revisions 
are
available to be merged and prevents you from double merging.  It allows 
you to
manually merge multiple non-continuous revision ranges in a single 
command.  It
also generates a commit log message for the merge using the log message 
for the
revision from the trunk.  Basically, merging is much easier than 
manually
dealing with 'svn merge -r REV1:REV2'.

After svnmerge.py is set up on the branch, if you want to pull a 
revision over,
you do.

$ cd stable
$ svnmerge.py -r 1234:1245,2345 # Merge revisions 1234 to 1245 and 2345 
over
$ svn diff # to confirm the merge
$ svn commit -F svnmerge-commit-message.txt

The svnmerge-commit-message.txt commit message would contain the log 
messages
for those revisions.  To see all revisions available for merge, run

$ svnmerge.py avail

You'll do something like this to set it up:

# Get the script:
$ svn cat 
http://svn.collab.net/repos/svn/trunk/contrib/client-side/svnmerge.py
 > svnmerge.py
$ chmod a+x svnmerge.py

# Check out your branch.
$ svn co http://dev.rubyonrails.org/svn/rails/branches/stable
$ cd stable

# Tell svnmerge.py to initialize the branch.  It looks to see what 
revision
# the branch was created from and initializes the revisions that were 
already
# copied over.

# Since there have been commits to both trunk and branch, this will be a 
little
# more complicated.  I recommend the following.  The  stable is almost 
identical
# to trunk at revision 4199 with one line difference.  So tell 
svnmerge.py
# that the branch is identical to the trunk from revisions 1-4199.

$ svnmerge.py -s -v -v init -r 1-4199

# Then resolve the any difference between stable and trunk by manually
# applying this patch.

--- ../rails-stable/railties/environments/environment.rb 
2006-04-07
11:49:46.000000000 -0700
+++ ./railties/environments/environment.rb      2006-04-07 
12:18:41.000000000 -0700
@@ -5,7 +5,7 @@
  # ENV['RAILS_ENV'] ||= 'production'

  # Specifies gem version of Rails to use when vendor/rails is not 
present
-<%= '# ' if freeze %>RAILS_GEM_VERSION = '<%= Rails::VERSION::STRING 
%>'
+<%= '# ' if freeze %>RAILS_GEM_VERSION = '<%= Rails::VERSION::STRING 
%>' unless
defined? RAILS_GEM_VERSION

  # Bootstrap the Rails environment, frameworks, and default 
configuration
  require File.join(File.dirname(__FILE__), 'boot')


# Finally, commit.
$ svn commit -F svnmerge-commit-message.txt

Regards,
Blair

--
Blair Zajac, Ph.D.
<blair@orcaware.com>
Subversion training, consulting and support
http://www.orcaware.com/svn/
Re: Use svnmerge.py for merging trunk to stable branch
Posted by Jeremy Kemper (Guest)
on 09.04.2006 19:46
On Apr 7, 2006, at 12:29 PM, Blair Zajac wrote:
> Now that Rails has a stable branch, I would like to suggest  
> considering using svnmerge.py to manage the revisions in trunk that  
> you want to pull over into the branch.  It'll make life much easier  
> in managing commits to trunk and then merging them to stable.

I've been using svk to similar effect.  It's great.

http://svk.elixus.org

jeremy