SVN modifies svn:mergeinfo property on files with no change

匿名 (未验证) 提交于 2019-12-03 08:50:26

问题:

I've a "problem" with svn I can't understand why sometimes when I merge two branches it reports modify on mergeinfo property on files with no changes on the text.
Is it a normal behavior?
If not, what can be the problem?

回答1:

Well, you did merge those two branches. Right? Works as expected.

What you did was do a merge. Even though the merge didn't result in any code changes, and that's not uncommon with merges, Subversion still marks that a merge was done. If nothing else, marking that you did a merge -- even though it resulted in no changes, is still a good idea. Imagine a release going out, and someone saying "Wait, no one merged that branch back into the trunk! We'll have to delay the release until we get that done" because they didn't see the merge in the svn:merge-info record.

So, yes what you saw can be normal behavior.

Now, if your question is "Why didn't my changes get merged", that's a different issue. Subversion usually does a good job with merges, but you have to make sure you do a few things:

  • Merge from the root of your project only, and not individual branches and files. There are exceptions, but most of the time you should be merging the branches of a project. Otherwise, you'll end up with svn:merge-info all over the place.
  • Know when to use the --reintegrate flag. You have a branch "A" (which could include trunk in this example). You make a branch "B" from branch "A".
    • When you merge from "A" to "B", you don't use --reintegrate
    • When you merge from "B" to "A", remember to use --reintegrate. It changes the way Subversion handled the merge.
  • Subversion doesn't handle highly complex merge situations very well. If you make a branch a whole slew of branches, and do merges back and forth between them, Subversion will mess up. This is one of the reasons I tell people not to do the branch per feature business. It makes tracking the various merges hard to do, and can cause Subversion to have merge problems. Maybe this is a feature: Since Subversion doesn't handle these highly complex merge situations very well, you have to avoid them. I've been able to talk many managers out of highly complex anti-pattern branching schemes by simply stating Subversion can't handle it.
  • If you manually merge your files (and many developers prefer to do this: Apply changes in the branch back to the trunk manually), use the svn merge --record-only, so that Subversion knows you've done the merge. Hilarity ensues when developers do some merges manually while others allow Subversion to do the merge.

So, if Subversion didn't merge in changes it should have, make sure that you're using the --reintegrate correctly, and that you're not having the other issues mentioned above.



回答2:

svn:mergeinfo property is used to track information about merges which have been performed in your repository.

See the SVNBook for details: "Mergeinfo and Previews".



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