将 trunk 合并到 SVN 中的功能分支时,如何避免出现大量 svn:mergeInfo
我试图通过将主干合并到分支中来保持功能分支最新。问题是,创建分支时存在的大约 2000 个文件,并且在分支和主干上都保持不变,除了 svn:mergeinfo 之外什么都没有更新。 该项目规模相当大,对我们的 SVN 历史记录的影响如此之大,以至于它导致合并提交历史记录无法使用,因为它标记了数千个已更改的文件,即使对这些文件的唯一更改是由 SVN 完成的本身。
我尝试过
- 使用与Repo相同的客户端版本(1.5.2)
- 使用我当前的客户端版本1.6.10
- 合并一系列修订,从分支开始到头部
我应该提到,我一直在仔细研究SVN文档当尝试这个时。因此不应违反任何规则(例如,不得切换子树、清理本地副本等)
I am trying to keep a feature branch up to date by merging trunk into the branch. Problem is, that about 2000 files that was there when the branch was created, and that has been left untouched on both the branch and on trunk is getting updated with nothing but svn:mergeinfo.
The project is rather large in scale, and the impact on our SVN history is so big, that it renders the merge commit history unusable as it is marking literally thousands of files changed, even though the only change to these files, is done by SVN itself.
I have tried
- Using the same client version as the Repo ( 1.5.2 )
- Using my current client version 1.6.10
- Merging a range of revisions, from branch start till head
I should mention, that I've been looking closely at the SVN documentation when trying this. So no rules should be broken ( eg. no switched subtrees, clean local copy etc.)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
基本上,要清理存储库,您需要在集成分支上运行以下命令,以便更改从那里散开:-
C:> svn propdel svn:mergeinfo –R
即您在主干中执行此操作,以便将来的版本和功能分支不会受到污染。合并现有分支时,您可以忽略“合并根”下面的所有 svn:merginfo 更改,因为它们无论如何都会被继承。
我不久前写了一篇关于这个问题的博客,其中更详细地介绍了它:-
清理 svn:mergeinfo Droppings
http://chrisoldwood.blogspot.com/2010/03/cleaning -up-svnmergeinfo-droppings.html
Bascially to clean up the repository you need to run the following on your integration branch so that the change fans out from there:-
C:> svn propdel svn:mergeinfo –R
i.e. you do it in the trunk so that future release and feature branches are not polluted. When merging existing branches you can ignore all svn:merginfo changes below the "merge root" as they will be inherited anyway.
I wrote a blog on this issue a while back which covers it in more detail:-
Cleaning up svn:mergeinfo Droppings
http://chrisoldwood.blogspot.com/2010/03/cleaning-up-svnmergeinfo-droppings.html
如果 svn 认为单个文件的合并历史记录与其父目录的合并历史记录不同,则会向其添加 mergeinfo 属性。一旦发生这种情况,每个后续合并,无论多么无害,都会导致这些合并信息属性被更新。我发现本文的前半部分有助于理解为什么会发生这种情况。
如果您想避免这些持续的合并信息更改,则必须“整理”分支上现有的合并信息属性。最安全但最费力的方法是在分支上运行 svn propget -R svn:mergeinfo ,然后研究各个文件上的 mergeinfo 与其父目录的 mergeinfo 之间的差异。您可能会发现差异很小,并且“svn merge”少量的单独修订就足以触发合并信息省略,导致所有单独的合并信息属性消失。
如果您确信自己了解合并信息的工作原理,您也可以直接介入并手动编辑或删除有问题的文件中的合并信息。
svn will add mergeinfo properties to individual files if it thinks their merge history differs from that of their parent directory. Once that has happened, every subsequent merge, no matter how harmless, will cause those mergeinfo properties to be updated. I found the first half of this article helpful to understand why that happens.
If you want to avoid these constant mergeinfo changes, you'll have to "tidy up" the existing mergeinfo properties on your branch. The safest, but most laborious, way is to run
svn propget -R svn:mergeinfo
on the branch, and then study the differences between the mergeinfo on individual files and the mergeinfo of their parent directory. You may find that the differences are small, and that "svn merge"ing a small number of individual revisions will be enough to trigger mergeinfo elision, causing all the individual mergeinfo properties to disappear.If you're confident you understand how mergeinfo works, you can also just wade in and manually edit or remove the mergeinfo from the offending files.
如果您在没有真正更改的文件上有这样的合并信息,那么您或其他人确实没有从工作副本根合并...唯一的解决方案是从文件中删除 svn:mergeinfo,因为唯一的位置在工作副本中将 root 复制到其他地方。
另一点你应该将存储库更新到 1.6.X ..
If you have such mergeinfo on files which aren't really changed you or someone else does merges not from the working copy root...The only solution is to removed the svn:mergeinfo from the files, cause the only location is in the working copy root nowhere else.
And one other point you should update the repository to 1.6.X ..
由于我对盲目 svn:merge-info 属性删除没有信心,我实现了一个工具来分析工作副本上的当前情况,并从非根合并中删除尽可能多的合并修订 -信息属性。经过额外的人工检查和控制后,可以提交工作副本上的更改。
这里是: svn-clean-mergeinfo
请随时报告有关其使用的任何问题使其得到改善。
As I am not confident with blind
svn:merge-info
property deletion, I have implemented a tool to analyze the current situation on a working copy and remove as much merge revisions as possible from non-root merge-info properties. After additional human checks and controls, the changes on the working copy can be committed.Here it is: svn-clean-mergeinfo
Do not hesitate to report any issue about its usage to get it improved.