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
-
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– malte07/25/2013 09:12:43Commented Jul 25, 2013 at 9:12
-
Sorry I was not asking of merge history . but svn history of each and every file changeSam– Sam07/25/2013 09:17:15Commented Jul 25, 2013 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– Ross Patterson07/25/2013 10:51:04Commented Jul 25, 2013 at 10:51
3 Answers 3
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/
-
cross branch history cant be done on 1.7 and lower ? so only option is to upgrade to 1.8 ?Sam– Sam07/25/2013 15:43:29Commented Jul 25, 2013 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 codeLazy Badger– Lazy Badger07/26/2013 11:31:38Commented Jul 26, 2013 at 11:31 -
Note that
svn blame
also supports-g
at least as far back as svn 1.6.11, so you can see where individual lines come from as wellIzkata– Izkata12/01/2015 22:49:51Commented Dec 1, 2015 at 22:49
In case of SVN 1.8
>svn log -v REPO-ROOT --search FILENAME
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.
-
-
1@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– OldCurmudgeon07/25/2013 15:47:55Commented Jul 25, 2013 at 15:47