人们如何管理跨多个(Mercurial)存储库存储的公共库文件的更改? [英] How do people manage changes to common library files stored across mutiple (Mercurial) repositories?

查看:70
本文介绍了人们如何管理跨多个(Mercurial)存储库存储的公共库文件的更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这也许不是Mercurial独有的问题,但这是我最近使用最多的SCM.

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.

由于存储在不相交存储库中的文件将具有不同的版本历史记录,因此如果我将文件复制回主存储库(甚至在两个独立项目之间),Mercurial将无法执行智能合并.

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).

我正在寻找一种保存更改历史记录的简便方法,因此我可以在不增加外部记录的情况下将库文件合并回主文件(这是我较少使用SVN的原因之一,因为合并需要记住跨分支制作副本时.

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.

推荐答案

三种解决方案,选择您喜欢的:

Three solutions, pick your favorite:

  1. 将所有项目放入一个存储库中.
  2. 为共享代码创建一个单独的存储库,为每个项目创建一个不同的存储库.
  3. 一个带有子存储库的存储库: https://www.mercurial-scm.org/wiki/子存储库,将所有通用代码保存在一个子存储库中,并为每个项目使用不同的子存储库.
  1. Put all projects into one repository.
  2. Make a separate repository for shared code and different repository for each project.
  3. One repository with Subrepositories: https://www.mercurial-scm.org/wiki/subrepos, keep all common code in one subrepo and different subrepos for each project.

由于没有保存历史记录,因此在没有共同祖先的存储库之间复制实际文件绝不是最佳选择.

Copying actual files between repositories with no common ancestors will never be optimal as history is not preserved.

这篇关于人们如何管理跨多个(Mercurial)存储库存储的公共库文件的更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆