views:

4108

answers:

7

When I'm doing a tortoise svn merge, it includes a bunch of directories, and some files into the modified files, even know there are no actual changes.

It changes the property svn:mergeinfo

Is there any reason why these properties set on the directory/files are needed? Is there any way to get around not doing these changes to svn:mergeinfo?

I usually just revert the items then commit, but this wastes extra time

+2  A: 

svn:mergeinfo is the property Subversion uses to track merge history. I'd just let it do what it has to do... you might need merge history tracking later and discover that it doesn't work because you didn't commit those properties.

Mauricio Scheffer
I agree, that's just metadata, and it will become more useful as the SVN client software, such as TortoiseSVN, evolves.
EnocNRoll
+14  A: 

That is happening, very likely, because those files and directories have the svn:mergeinfo property set from a previous merge. I don't think it's generally a good idea to merge individual files or directories in a way that causes the mergeinfo to be written to individual files. You should get into the habit of merging at the highest level possible for your workflow, so that the mergeinfo property is only set on structural directories, such as /trunk or /branches/1.0.

However, if you do find yourself with mergeinfo properties on individual files and folders, there are two things you can do: the first thing is simply to remove the svn:mergeinfo property from the files and directories in question. I'm not sure this is recommended unless you really know what you're doing, and what the effects might be. Read the documentation before you do this!

The second thing you can do is commit the property changes the way SVN wants you to, which, if you trust the software, is probably the right thing do.

That having been said, I've been working with my teammates to get in the right habits so that we don't have this annoyance any more.

RibaldEddie
Thanks, it seems almost random which files have this property set, and it must be from past developers merging from the non root directory. I will remove them.
Brian R. Bondy
Thanks a bunch for clarifying how this happened :)
TheXenocide
+14  A: 

What happens is that once a file/folder has explicit mergeinfo, each subsequent merge to the branch will update that mergeinfo even if the file/folder is unrelated. This is annoying as it introduces more and more clutter in the changelist for each merge.

To avoid this, only merge to the "root" folder of the branch, for example "/branches/maintenance2.x". None of the files or folders below "/branches/maintenance2.x" should then get mergeinfo. Follow the merging advice in the svn book.

Unfortunately, even if you merge only at the "root" folder of the branch, empty svn:mergeinfo properties can still appear on individual files and folders when they are copied, to indicate that they have not received the same merges as their siblings.

It is probably safe to delete the superfluous subtree mergeinfo. One way to do this is by doing a recursive deletion of the svn:mergeinfo property on each file and folder in your project root.

Alternatively, you can upgrade to subversion 1.6. I believe have verified that it fixes this issue. It even seems to delete superfluous mergeinfo added by earlier versions for you.

edit: judging from the comments there are still cases in svn 1.6 where superfluous sub-tree mergeinfo appears. But I have not been able to reproduce that.

Wim Coenen
I can confirm that svn 1.6 does not fix this issue.
Mike Miller
However I can confirm that simply deleting all the extra properties manually made much of the problem go away.
Mike Miller
Simply using 1.6 does not fix this issue as it is actually expected functionality, albeit a slightly annoying one for people using a typical branch/trunk model.
TheXenocide
If you are talking about 1.6 fixes some issues does this mean I have to update the client, the server or both?
Malcolm Frexner
@Malcolm: I meant the client.
Wim Coenen
+5  A: 

If you do your merges with the --ignore-ancestry option, then the mergeinfo properties will not be created in the first place.

svn merge --ignore-ancestry -c 1234 svn://sourcecontrol .
Chase Seibert
A: 

We removed it recursively on our project because just about all files had this info which made mergeing very annoying (if only one file had been altered, all files had to be merged). From now on we'll only merge on the root, which should avoid this situation in the future.

It hasn't given us any problems so far. Logging is still available on files and seems to be the same (but do it at your own risk anyway!).

Oh, we did it on our trunk, just before making a new branch. This way, we can start from a clean slate.

Peter
+1  A: 

Although this is quite an old question, I just thought that I would add that at least one part of this bug was fixed in subversion 1.5.5. From the 1.5.5 CHANGES file:

do not create mergeinfo for wc-wc moves or copies (r34184, -585)

That is, there was a bug in svn prior to 1.5 where it would create mergeinfo entries that it didn't use, and were superfluous, and this is likely what the original questioner was hitting if they had a lot of svn:mergeinfo properties.

Paul Wagland
A: 

Great question and answer! We've been having this probelm lately, because we're trying to work around limitations of our automated build system. Our build system auto-increments the .bdsproj and some of the .dpr/.dpk files with version and path info. I want to change that... but right now, if you want to merge one branch with another, you get the handful of files that you changed, and then 1000 files that the build machine changed. So we've been doing "targeted" merges, sometimes a file at a time. Especially with .dpr or .bdsproj files that have legitimate changes (such as the inclusion of an extra unit). Now I know what's going on, so I can hopefully put a stop to the madness. Thanks SO!

Chris Thornton