人们如何管理对多个 (Mercurial) 存储库中存储的通用库文件的更改?
这也许不是 Mercurial 独有的问题,但这是我最近使用最多的 SCM。
我从事多个项目,并且倾向于从以前的项目中复制库或实用程序的源代码,以便在启动新项目时占据优势。当我想将我在最新项目中所做的所有更改合并回这些共享库文件的“主”副本时,问题就出现了。
由于存储在不相交存储库中的文件将具有不同的版本历史记录,因此如果我只是将文件复制回主存储库(甚至在两个独立项目之间),Mercurial 将无法执行智能合并。
我正在寻找一种简单的方法来保留更改历史记录,以便我可以将库文件合并回主文件,同时保留最少的外部记录(这是我较少使用 SVN 的原因之一,因为合并需要记住副本的时间)跨分支制作)。
也许我需要对我的存储库进行更多的前期组织,以便为将来合并回公共母版做好准备。
This is perhaps not a question unique to Mercurial, but that's the SCM that I've been using most lately.
I work on multiple projects and tend to copy source code for libraries or utilities from a previous project to get a leg up on starting a new project. The problem comes in when I want to merge all the changes I made in my latest project, back into a "master" copy of those shared library files.
Since the files stored in disjoint repositories will have distinct version histories, Mercurial won't be able to perform an intelligent merge if I just copy the files back to the master repo (or even between two independent projects).
I'm looking for an easy way to preserve the change history so I can merge library files back to the master with a minimum of external record keeping (which is one of the reasons I'm using SVN less as merges require remembering when copies were made across branches).
Perhaps I need to do a bit more up-front organization of my repository to prepare for a future merge back to a common master.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
三种解决方案,选择您最喜欢的:
在没有共同祖先的存储库之间复制实际文件永远不会是最佳选择,因为不会保留历史记录。
Three solutions, pick your favorite:
Copying actual files between repositories with no common ancestors will never be optimal as history is not preserved.
我建议您不要“复制源代码”做法,而是对自定义库使用二进制分发。这些二进制文件与源代码一起签入。
编辑:对于一般“通用”或“工具箱”库的问题,请阅读 这篇文章来自 ayende。
I'd recommend against your "copy the sourcecode" practice but use binary distribution for your custom libraries instead. These binaries are checked in along the sourcecode.
EDIT: And for the issue with "common" or "toolbox" libaries in general, read this post from ayende.
使用移植扩展
use the transplant extension