简体   繁体   English

Subversion合并:始终用新版本替换文件

[英]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)? 在进行合并时,是否有任何subversion属性可以设置为始终用较新的ervision替换文件(而不是做差异并在无法合并时引发冲突)?

The set of files I am referring to is the C# project files (*.csproj). 我所指的文件集是C#项目文件(* .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. 如果指定--accept theirs-full作为svn merge的选项,则可以在存储库方面进行更改,并在发生冲突时自行删除。

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. 有关建议的执行方式,请参阅SVN常见问题解答

We have exclusive locks on a couple of file types, one being cproj files. 我们对几种文件类型有独占锁,一种是cproj文件。 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. 然后,您可以将项目文件添加到svn:ignore,您不必再担心它了。

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#项目文件,将其设置为编译,并对他们希望的项目设置进行任何本地修改,而不会破坏您的构建。 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. C#项目文件有点麻烦,但这仍然是最糟糕的10-15分钟的工作,你只需要做一次。

I don't know of a way to automatically have svn/tortoisesvn "Accept Theirs" automatically on a merge conflict. 我不知道在合并冲突中自动拥有svn / tortoisesvn“自己接受”的方法。 Doing it manually is how I've always handled bunk merge-conflict. 手动执行是我总是处理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. 你应该能够通过TortoiseSVN通过告诉Tortoise使用'他们'文件来解决冲突,消除你所做的任何改变。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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