views:

953

answers:

2

Since we've switched to VS2010 we've noticed a new .filters file that apparently contains the filter structure of the project. We're also using subversion as our source control.

Unfortunately, every time we check in now we end up with merge conflicts if anyone's added a file or filter to the project. SVN seems absolutely incapable of merging this file type correctly even though it's text based. It's getting rather frustrating.

Is anyone else dealing with this problem? Has anyone found a solution?

+1  A: 

If the ".filters" file is something specific to the user's configuration, then it probably does not belong in Subversion at all. You can make Subversion ignore changes to the file using the svn:ignore property:

svn propset svn:ignore '.filters' .

The command above will make Subversion start ignoring changes to the file named ".filters".

Another option is to force Subversion to treat the ".filters" file as a binary file:

svn propset svn:mime-type 'application/octet-stream' .filters

The command above will cause the ".filters" file to be treated as a binary file and will not be merged.

Edit
Now that you've explained that the ".filters" file is essential to the project and also that the problem may be that it is being treated as binary instead of as plain text, the solution is to set the type to plaintext:

svn propset svn:mime-type 'text/plain' .filters
Michael Aaron Safyan
This is the same answer someone else gave and then deleted. Losing the filters in a project results in a totally flat project structure so that all files appear at the top level. It's not going to work for even small projects.
Noah Roberts
+3  A: 

They're plain xml files like the visual studio other project files - I can't see why they should be any more susceptible to conflicts than other project files.

Are these files perchance being treated as binary and not as text? Merging binary files won't work - check the svn properties to see what mime-type they're set to (if no mime-type is set, you should be fine). If the mime type is set, it's possible you're dealing with a misconfigured automatic property.

Finally, it's possible people are constantly adding+removing files - if so, you may just need to commit and update more frequently until the project settles down a bit more.

You definitely should not svn:ignore these files.

Eamon Nerbonne
This answer showed a lot of promise. The fact that the auto property stuff isn't working is no surprise since it appears there is some funky character at the beginning of these things that is not text. Setting the svn:mime-type for the file to "text/xml" didn't solve the problem though. Having the svn admin dude try to find the system wide approach and we'll try that.
Noah Roberts
If you can access your svn via http - common, since many people use apache to host svn - you can just download the filter file in your webbrowser and check (e.g. with firebug or http fiddler) as what mime type the file ends up getting served.
Eamon Nerbonne
Could the "funky character" at the beginning of the file be a Unicode Byte-Order Mark (http://en.wikipedia.org/wiki/Byte_order_mark)? The BOM should not be a problem for UTF-8 or UTF-16 given the way Subversion distinguishes between text files and binary files: http://subversion.apache.org/faq.html#binary-files. It would cause a problem with UTF-32 since two of those bytes would be zero.
Adrian Lopez
Accepted this answer not because it solves the problem but it was the best and I had to pick one. It is a good answer that has sent us down some paths we might not have tried.
Noah Roberts
It would have helped it you'd told us more about the kinds of conflicts you're getting. It's hard to solve a problem when you don't have enough information about the nature of that problem.
Adrian Lopez
It just occurred to me that even though the BOM would not be a problem with UTF-16, such an encoding would still cause problems with Subversion if any characters are encoded as 0x00?? in the first 1024 bytes. What encoding does Visual Studio use for vcxproj.filters files?
Adrian Lopez