我有一个关于 Mercurial (HG) 存储库的项目。我即将开始一个新项目,我想通过使用与上述项目完全相同的代码来开始。这两个项目完全无关。尽管他们做类似的事情,但每一件都是针对不同的客户,具有不同的名称、不同的品牌和不同的艺术。
我的问题是:
推荐的方法是什么:
- 克隆(hg clone)项目并开始进行更改?
- 归档(hg archive)项目并在归档副本上创建一个新的存储库(hg init)?
- 还有其他我没有考虑的选择吗?
多谢。
I have a project on a Mercurial (HG) repository. I am about to start a new project that I would like to start by using the exact same code as the mentioned project. The two projects are completely unrelated. Even though they do similar stuff, each one is for a different client, carry different names, different branding, different art.
My question is:
What would be the recommended approach:
- Cloning (hg clone) the project and start making changes?
- Archiving (hg archive) the project and making a new repository (hg init) on the archived copy?
- Any other option I am not considering?
Thanks a lot.
发布评论
评论(3)
我将扩展我之前提出的评论,建议将通用功能放入库中,以避免在两个地方维护相同代码库的重复工作,并建议您是否可以将每个实例作为一个分支通用代码库,那么这可能是理想的。希望这样,如果您修复一个分支中的错误,那么合并分支应该很容易,或者至少可以轻松地以一致的方式应用更改。
I'm going to expand on the comment I made earlier suggesting that common functionality should be put into a library to avoid duplicated effort in maintaining the same code base in two places and suggest that if you can get away with making each instance a branch of the common codebase, then that's probably ideal. Hopefully that way if you fix a bug in one branch, it should be easy enough to merge branches or at least apply the changes in consistent ways easily.
如果它使用“与提到的项目完全相同的代码”并且仅在品牌上有所不同,那么您可能希望从原始项目中分支出来。尽管最初情况是相同的,但稍后客户需求可能会有所不同(读取分支)。此外,内容文件也会开始有所不同。
简短的回答:是的,克隆并分支每个项目。通过分布式修订控制,您可以随时合并(如果需要)。
If it uses the "exact same code as the mentioned project" and differs only in branding then you would probably want to branch off from the original project. Although initially things are identical client requirements may diverge (read branch) later on. Also the content files would begin to differ.
Short answer: Yes clone and branch off each project. With distributed revision control you can always merge if you need to.
在您接受任何人(正确的!)建议进行分支之前,请阅读这篇文章:http://stevelosh.com/blog/2009/08/a-guide-to-branching-in-mercurial/ 并决定在 Mercurial 中进行分支的众多有效方法中的哪一种是适合您。人们听到“branch”并使用 hgbranch,这是一种分支方式,但不是唯一的一种,也不一定是正确的一种。
如果我是你,我只会克隆,开始在克隆中工作,然后当你可以(根据 Gian 的伟大建议)重构到一个公共基础库时协调它们。
Before you take anyone's (correct!) advice to branch, please read this article: http://stevelosh.com/blog/2009/08/a-guide-to-branching-in-mercurial/ and decide which of the many, valid ways to branch in mercurial is right for you. People hear "branch" and use
hg branch
which is one way to branch, but not the only one or necessarily the right one.Were I you I'd just clone, start working in the clone, and reconcile them later when you can (per Gian's great advice) refactor into a common base library.