How to capture svn Merge Information

扶醉桌前 提交于 2019-12-08 02:43:46

问题


I have checked out the trunk and have done a merge from branch to trunk. Now all the changes made in branch are present in my trunk working copy. If I do a commit on this working copy, is there any way to identify later that it was a merge and not like a normal checkout-modify-checkin. I can specify the merge details in the log, but I am interested if SVN has some methods to identify and track this.

I have seen in other version control tools like clearcase, a merge arrow will come in the version tree, for each merges. Is there anything like that (some merge symbol or merge arrow) we have for SVN?


回答1:


You should see that there are changes to the svn:mergeinfo property on one or more paths. This is used to track what was merged. You can then use the svn mergeinfo command to see what paths have been merged or are eligible to be merged from a source branch to another branch. svn mergeinfo can also display a somewhat crude graph for the merge if you don't pass it a --show-revs argument in 1.8. As Dipu H already mentioned in his comment you can also see merged revisions with the -g option to svn log.

Based on your tag it seems that you're using TortoiseSVN. As far as I know TortoiseSVN doesn't have a way to visualize the mergeinfo with the revision graph feature it has. Smart SVN is a commercial Subversion client that has such a feature (full disclosure I work for the company that produces Smart SVN). Subclipse has such a feature as well if you're using Eclipse. There is a plugin for JetBrains IDEs as well.

So I'm sure if you searched you'll find something that works for you. But I don't know enough about your environment to point you in any particular direction.




回答2:


Alternative to Ben's mergeinfo method

Let's inspect such (test) repository

with branch and some cross-nodes merges in process

Log for branch (lazy log, without --stop-on-copy)

reading>svn log -g -q -v
------------------------------------------------------------------------
r7 | Badger | 2014-01-30 13:51:41 +0600 (Чт, 30 янв 2014)
Changed paths:
   M /branches/reading/1.txt
------------------------------------------------------------------------
r6 | Badger | 2014-01-30 13:50:34 +0600 (Чт, 30 янв 2014)
Changed paths:
   M /branches/reading
   M /branches/reading/1.txt
------------------------------------------------------------------------
r5 | Badger | 2014-01-30 13:43:45 +0600 (Чт, 30 янв 2014)
Changed paths:
   M /trunk/1.txt
Merged via: r6
------------------------------------------------------------------------
r4 | Badger | 2014-01-30 13:42:59 +0600 (Чт, 30 янв 2014)
Changed paths:
   M /branches/reading/1.txt
------------------------------------------------------------------------
r3 | Badger | 2014-01-30 13:39:37 +0600 (Чт, 30 янв 2014)
Changed paths:
   A /branches/reading (from /trunk:2)
------------------------------------------------------------------------
r2 | Badger | 2014-01-30 13:36:46 +0600 (Чт, 30 янв 2014)
Changed paths:
   A /trunk/1.txt
------------------------------------------------------------------------
r1 | Badger | 2014-01-30 13:35:19 +0600 (Чт, 30 янв 2014)
Changed paths:
   A /branches
   A /tags
   A /trunk
------------------------------------------------------------------------

Even without log-message in r6 Merged via: r6 from r5 clearly states: r6 is mergeset, where trunk's HEAD (r5) was merged into branch

Log (relevant part of) for trunk

WC>svn log -g -q -v
------------------------------------------------------------------------
r8 | Badger | 2014-01-30 13:56:09 +0600 (Чт, 30 янв 2014)
Changed paths:
   M /trunk
   M /trunk/1.txt
------------------------------------------------------------------------
r7 | Badger | 2014-01-30 13:51:41 +0600 (Чт, 30 янв 2014)
Changed paths:
   M /branches/reading/1.txt
Merged via: r8
------------------------------------------------------------------------
r6 | Badger | 2014-01-30 13:50:34 +0600 (Чт, 30 янв 2014)
Changed paths:
   M /branches/reading
   M /branches/reading/1.txt
Merged via: r8
------------------------------------------------------------------------
r4 | Badger | 2014-01-30 13:42:59 +0600 (Чт, 30 янв 2014)
Changed paths:
   M /branches/reading/1.txt
Merged via: r8
------------------------------------------------------------------------
r3 | Badger | 2014-01-30 13:39:37 +0600 (Чт, 30 янв 2014)
Changed paths:
   A /branches/reading (from /trunk:2)
Merged via: r8
------------------------------------------------------------------------

Merged via: r8 in log records for r3:r7 show next mergepoint (at this time - from branch to trunk)

In short: mergeinfo show what was merged, log -g - what and when



来源:https://stackoverflow.com/questions/21433549/how-to-capture-svn-merge-information

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!