Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

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

share|improve this question
    
I am not sure what you mean by history. I have posted my answer assuming that by history you mean following up on what revisions were merged to trunk from the development branch. Is this accurate or do you mean something else? –  malte Jul 25 '13 at 9:12
    
Sorry I was not asking of merge history . but svn history of each and every file change –  Sam Jul 25 '13 at 9:17
    
This is one of the reasons why code-on-trunk-merge-to-branch is often a better model of development. –  Ross Patterson Jul 25 '13 at 10:51
add comment

3 Answers

up vote 5 down vote accepted

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/
share|improve this answer
    
cross branch history cant be done on 1.7 and lower ? so only option is to upgrade to 1.8 ? –  Sam Jul 25 '13 at 15:43
    
@Sam - --search isn't cross-branch history - it's (as written) just search inside log-data. You can parse pre-1.8 logs for the same results, but it must be your own code –  Lazy Badger Jul 26 '13 at 11:31
add comment

In case of SVN 1.8

>svn log -v REPO-ROOT --search FILENAME

share|improve this answer
add comment

I use both SVN (dictated by business) and Mercurial (local repo only).

Netbeans handles this situation fine - not sure how it would integrate with other IDEs.

This provides me with many benefits. An update from SVN often makes changes I am not aware of but Mercurial immediately picks them up. I can take a new Clone and copy the old .hg folder in and instantly see all the changes.

Best of all, Mercurial works much easier with Diff patches and Quilt.

share|improve this answer
    
unfortunately we are stuck with svn –  Sam Jul 25 '13 at 15:45
    
@Sam - that is my point - install Mercurial as well. Clone from SVN, Initialize a Mercurial project from the code and you have the benefits of both. I have to use SVN too. –  OldCurmudgeon Jul 25 '13 at 15:47
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.