Version Control – Maintaining SVN History During Merges

branchingsvnversion control

In my org, we use SVN for version control So for each build (done periodically), we merge the code to trunk from the development branch (all the developers checks in to this branch). So when we want a new branch say for a new release, we create from the trunk doing a svn copy.

Now in the new branch we have the history only from the trunk and not from the previous development branches.

Is there any way to maintain the history when merge is done from the dev branch to trunk?

Update :

By history I meant revision History of each and every file . Who created it and who edit it.

Unfortunately we are using svn 1.6 right now

Best Answer

Unfortunately this is not supported directly by Subversion prior to Subversion 1.8. The files in the branch and the files in trunk are copies and Subversion keeps track with svn log only for specific files, not across branches.

So the only option is to filter your SVN log. The major downside to this is that in case you filter for file name, files being moved or copied to another name are not matched.

Subversion 1.7 and lower

To keep it practical I would get the history of the file you are interested in for your trunk

svn log http://www.your.org/svn/repo/trunk/path/to/file.txt -g

This includes the mergeinfo for your file like this:

Commit message
Merged via: r6504, r6493, r6451, r6429

Now you can see where the file comes from and then look up those revisions on your repository root with

svn log http://www.your.org/svn/repo -r 6504

Subversion 1.8 and higher

The Subversion 1.8 release contains a couple of improvements to the command line client that make the above easier. To find all log entries for a specific file you can simply search for it directly:

 svn log -v --search "src/foo.c" http://svn.example.com/svn/