Subversion: Merging specific commits of a specific user from a branch into trunk

I do some software development from time to time during my job at the university and I use Subversion (SVN) to manage my source code.

When a bachelor or master student works on a software I wrote to implement some features, I give them SVN access and a new branch in the SVN repository, usually named branches/student/. Once in a while I have a look at their code and pull some of their changes into trunk/ and integrate them.

NOTE: Sometimes you want to merge the whole branch into trunk at the end of their work (once they are finished). This article does NOT handle that. It rather explains how to get a list of the changes of a certain user and pull only one commit into trunk.

Here is what you usually need to do for this:

1) Find all commits by the user student123


cd ~/develop/project_repo/ # this dir contains trunk/, tags/ and branches/
svn up
svn log | sed -n '/student123/,/-----$/ p'

2) Merge the changes from her branch feature_xyz into trunk/:

Let us assume we want to get revision 603 into trunk.


cd ~/develop/project_repo/trunk/
svn merge -c603 --username mysvnuser svn+ssh://mysvnuser@my.svn.server.org/project_repo/branches/feature_xyz

Now check the changes, fix conflicts, test the code. When ready:


svn commit -m "integrated r603 by student123 into trunk"

That’s it.

Advertisements

About dfspspirit

PhD student in bioinformatics, interested in photography, level design, digital image manipulation, architecture and, of course, bioinformatics.
This entry was posted in bash, coding, subversion, tools and tagged , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s