当对源代码进行频繁且大量的更改时,我们是否应该使用颠覆?
我们有很多 xml 文件正在检查到 subversion 存储库中(假设有 30,000 个)。我们对这些文件执行转换,这有时会导致很大的差异。在开发的这个阶段,我们经常看到 xml 的完全重写/重新结构。稍后,更改将是微妙的,我们当然希望从版本控制系统提供的所有功能中受益;然而,现在颠覆正在制造问题。具体来说,更新、合并会产生巨大的冲突,而这些冲突实际上是不可能解决的。我们现在不应该使用 subversion 来管理这个 XML 吗?或者(希望)有人可以推荐一种更好的方法来使所有开发人员保持同步(我们都需要 XML)并最终保持正确的版本控制。
We have a LOT of xml files that we are checking into a subversion repository (let's say 30,000). We perform transformations on those files and this sometimes results in large differences. At this phase of development, we often see a complete re-write/re-structure of the xml. Later, changes will be subtle and we'll certainly want to benefit from all that a version control system offers; however, right now subversion is creating problems. Specifically, updating, merging, create massive conflicts, which are virtually impossible to resolve. Should we not be using subversion for managing this XML, right now? OR (hopefully) someone can recommend a better way of keeping all of the developers in-synch (we all need the XML) and eventually keep it properly versioned.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您应该避免将自动生成的内容置于版本控制之下。相反,将文件的生成集成到 Makefile 中,只要原始输入发生变化就运行该文件。
如果您正在使用自动生成和手动编辑的混合,请尝试将手动编辑隔离到某种调整定义中,然后将其集成到自动构建中。
如果上述所有方法都不切实际,最后的办法是 告诉 Subversion 这些文件是二进制文件。这不会避免合并冲突,但会防止 Subversion 通过尝试注释冲突来破坏 XML。
You should avoid placing automatically generated content under version control. Instead, integrate the generation of files into a Makefile that you run whenever the raw inputs change.
If you are working with a mixture of auto-gen and hand-editing, try to isolate the hand-edits into some kind of tweaks definition, which you then integrate into the automated build.
If all the above is impractical, the last resort is to tell Subversion that the files are binaries. This won't avoid merge conflicts, but it will prevent Subversion from mutilating the XML by trying to annotate the conflicts.
一般来说,不同版本之间存在较大差异应该没有问题。但如果发生大规模冲突,情况就会有所不同。也许你没有完整地告诉我们整个场景。仅当两个人同时对同一个文件进行更改时才会出现冲突。当其中一个对一个文件进行重组,而另一个文件同时处理该文件时,您如何期望合并这些更改?
简而言之,这不是使用 SVN 引起的问题。当你重构某些东西时,只在一台机器上进行,并且不要让其他人同时处理同一个文件。平行线。
据我所知,您可以将 SVN 配置为悲观(独占)文件锁定,因此它可以帮助您确保一次只有一个人对同一文件进行更改。
Having large differences between different revisions should be no problem in general. But if you are getting massive conflicts, there is something different going on. Perhaps you did not tell us the whole scenario completely. Conflicts can only arise when two people make changes simultanously to the same file. When one of those makes a restructuring of one file, while another one is working on it the same time, how do you expect to merge those changes anyhow?
To make it short, that is not a problem caused by using SVN. When you restructure something, do it on only one machine, and don't let anyone else work on the same file at that time in parallel.
AFAIK you can configure SVN for pessimistic (exclusive) locking of files, so it helps you to make sure there is only one person at a time making changes to the same file.
将 XML 文件中表示的数据存储在数据库中。然后编写一个相当简单的程序,使用 LINQ to XML 将该数据转换为 XML 文档。
您还可以将“XML”文档的后续版本保存在不同的表中,以便可以存档以前的版本。
Store the data that is being represented in the XML files in a database. Then write a fairly simple program to transform that data into an XML document using LINQ to XML.
You could also save subsequent versions of the "XML" documents in different tables so you can archive previous versions.