views:

384

answers:

4

Hi, when doing a merge, is there any subversion property that I can set to always replace the file with the newer ervision (instead of doing a diff and raise a conflict when it can't merge)?

The set of files I am referring to is the c# project files (*.csproj). These files always raise a conflict. I would like to have these files always update to whichever revision that's newer when I do a merge.

Thank you,

A: 

Ideally you wouldn't commit the project files at all, just the source and necessary libraries to compile. You can then add your project files to svn:ignore and you won't have to worry about it anymore.

Other developers on your project are then free to create a C# project file around the existing workspace, set it up to compile, and do any local modifications to the project setup they wish without breaking your build. C# project files are a little cumbersome, but this is still at worst a 10-15 minute job, and you only have to do it once.

Cory Petosky
Visual Studio C# project files contain much much more than just a list of the source files; leaving them out of source control practically guarantees that different developers get different results from the code, leading directly to a lot of "works on my machine" faults.
Bevan
I think project references are also in the project files. I think it will be more painful to manage the references if I don't commit the project files.
David
A: 

I don't know of a way to automatically have svn/tortoisesvn "Accept Theirs" automatically on a merge conflict. Doing it manually is how I've always handled bunk merge-conflict. You should be able to, with TortoiseSVN, resolve the conflict by telling Tortoise to revolve with 'their' file, wiping out any changes you've made.

Yoopergeek
+1  A: 

Yes.

If you specify --accept theirs-full as an option to svn merge, you can make to get the changes as done on the repository side, and loose your own, in the event of a conflict.

EDIT: On second thought, I agree that you probably shouldn't be doing this. See the SVN FAQ for the recommended way of doing this.

Avi
Thank Avi, but is there anyway I can turn on --accept for files with certain extension?
David
Sorry, I don't know of any. Of course, you can merge files separately, but this might be a little hard to automate.
Avi
A: 

We have exclusive locks on a couple of file types, one being cproj files. We also have a working practice whereby devs only a hold the lock for a minimal amount of time, i.e. if you add a class then grab the lock, add an empty class stub (that compiles!) then release. I know many frown at exclusive locks in subversion but it works pretty well on small to medium projects. Not sure if I’d like to scale it up to large projects.

Vman