简体   繁体   中英

Subversion merge: Always replace file with new revision

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.

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.

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, ie 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.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM