SVN分支比较
如何将一个分支与另一个分支进行比较?我想将分支与主干中的最新版本进行比较。
How do I compare one branch with another? I want to compare a branch with the latest revision in trunk.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
您可以从以下内容开始:(
其中
http://REPOS
是您的存储库路径,包括trunk
和branches
的父级。)这将打印大量文本,包括所有文本更改,但不包括二进制更改,除非说明它们发生的地点和时间。
You could start with:
(Where
http://REPOS
is your repository path including the parents oftrunk
andbranches
.)This will print a large quantity of text, including all the textual changes but not the binary changes except to say where and when they occurred.
如果您只是寻找高级文件的不同之处并且不想查看所有内容,请使用:
svn diff ^/trunk ^/branches/dev --summarize
(这比较了 trunk 和开发分支)
If you are just looking for high level of what files are different and do not want to see all the contents, use:
svn diff ^/trunk ^/branches/dev --summarize
(This compares trunk and dev branch)
我通常将两个分支(或分支和主干)签入目录。
然后我使用 Kompare 或类似的图形工具(取决于您的偏好、操作系统……)。
当我需要执行复杂的合并时,这对我来说非常有帮助。
I usually check out the two branches (or the branch and the trunk) into directories.
Then I use a graphical tool like Kompare or similar (depending on your preferences, operating system,...).
This is really helpful for me when I need to perform complex merges.
由于缺乏声誉,我无法将其添加为针对现有答案的评论,因此我必须将其添加为单独的答案。
对我来说,
svn diff
的一个有用选项是--ignore-properties
。我的两个分支最终以相同的代码方式结束,但具有不同的合并历史。使用
--ignore-properties
让我可以向自己证明情况确实如此,而无需费力地进行大量的“svn:mergeinfo”属性更改。As lack of reputation won't let me add this as a comment against an existing answer, I'm having to add it as a separate one.
A useful option to
svn diff
for me was--ignore-properties
. My two branches had ended up identical code wise, but with different merge histories.Using
--ignore-properties
allowed me to prove to myself that this was the case, without wading through the large quantity of "svn:mergeinfo" property changes.感谢您提供的信息,我会添加一些内容来提高差异结果的可读性。如果您使用:
svn diff svn://url:9090/branches/PRD_0002 svn://url:9090/branches/TST_0003 >svn_diff_filename.txt
您可以使用:
findstr "Index:" C:\path\svn_diff_filename.txt > svn_diff_file_list.txt
这将为您带来一个有任何差异的文件的可读列表。
Thanks for the info guys, I would add something to improve the readability of the diff results.If you used:
svn diff svn://url:9090/branches/PRD_0002 svn://url:9090/branches/TST_0003 >svn_diff_filename.txt
You can use:
findstr "Index:" C:\path\svn_diff_filename.txt >svn_diff_file_list.txt
That will bring you a readable list of files that have any differences.
这是Murray Cumming 的帖子 其中描述了非显而易见的过程:
svn diff -r123:145
Here's a post from Murray Cumming which describes the non-obvious process:
svn diff -r123:145
要区分分支的两个修订版:
使用 svn log 获取不同的修订版。使用
svn log -l 5
可以限制日志中的修订数量。仅显示最后 5 个修订。To diff between two revisions of a branch:
Use
svn log
to get the different revisions. Use can limit the number of revisions in the log usingsvn log -l 5
. only the last 5 revisions will be shown.