在 Mercurial 中使用 Skeleton 进行多个类似项目

发布于 2024-12-05 10:22:35 字数 339 浏览 1 评论 0原文

我有多个模块,每个模块都在自己的存储库中。 然后是一个框架,其中包含一些对所有客户端通用的基本代码,以及始终包含的一些模块的子存储库。

在新客户端上使用此设置的最佳方式是什么?

我目前遇到的问题是: - 如果我克隆骨架,然后在骨架中添加一些内容并将其推送到服务器,骨架就会更新。

如果我为客户端的每个项目都有一个存储库,在其中克隆骨架,则会发生同样的事情:骨架中的更改被推送到骨架。

现在,我可能可以通过克隆骨架然后立即在骨架中为客户端创建一个新分支来解决这个问题,但我更喜欢它有自己的存储库用于交付到服务器,而不是作为骨架的分支(我想将其用于骨架版本,而不是项目)。

您有什么建议?

I have multiple modules, each in their own repository.
Then there's a skeleton, which has some basic code that's common for all clients, with subrepos of some modules that are always included.

What is the best way to use this set-up on a new client?

The problem I'm currently experiencing is:
- if I clone the skeleton and then add something in the skeleton and push it to the server, the skeleton gets updated.

If I have a repository per project for the client in which I clone the skeleton, the same thing happens: the changes in the skeleton are pushed to the skeleton.

Now, I can probably fix this by cloning the skeleton and then immediately creating a new branch for the client in the skeleton, but I prefer if it has its own repository for the delivery to the server, instead of being a branch of the skeleton (which I want to use for skeleton versions, not projects).

What are your suggestions?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

残疾 2024-12-12 10:22:35

如果我理解正确的话,缺少的信息是您可以在进行克隆后更改默认推送路径。当您运行

$ hg clone http://hg.server/repos/skeleton client-a

以从 sculpture 存储库获取 client-a 克隆时,Mercurial 会使用

[paths]
default = http://hg.server/repos/skeleton

So < 创建 client-a/.hg/hgrc code>hg Push 现在会将变更集发送到该存储库。您应该在服务器上创建一个新的克隆:

$ hg clone skeleton client-a

然后在您的计算机上对其进行克隆:

$ hg clone http://hg.server/repos/client-a

对框架代码的更改将不再自动传播到服务器上的框架存储库。

这样做的一个重要缺点是您的所有客户端存储库都将“兼容”,这意味着您可能会意外地执行此

$ cd client-a
$ hg pull http://hg.server/repos/client-b

操作:这在 client-aclient-b 中有效code> 在骨架存储库中共享一个共同的祖先。因此,我只需复制框架文件并将它们重新添加到每个客户端存储库:

$ unzip skeleton.zip
$ rm skeleton.zip
$ hg add
$ hg commit -m "Initialized repository for client-a"

由于每个客户端的日期和提交消息都不同,因此存储库将变得不相关hg如果您尝试混合来自不同客户端的变更集,pushhg pull 将出错。

If I understand you correctly, the missing bit of information is that you can change the default push path after making a clone. When you run

$ hg clone http://hg.server/repos/skeleton client-a

to get a client-a clone from the skeleton repo, then Mercurial creates client-a/.hg/hgrc with

[paths]
default = http://hg.server/repos/skeleton

So hg push will now send changesets to that repository. You should instead make a new clone on the server:

$ hg clone skeleton client-a

and then make a clone of that on your machine:

$ hg clone http://hg.server/repos/client-a

Changes to the skeleton code will then no longer automatically propagate to the skeleton repo on the server.

An important down-side of this is that all your client repositories will be "compatible" This means that you can do this by accident:

$ cd client-a
$ hg pull http://hg.server/repos/client-b

This works since client-a and client-b share a common ancestor in the skeleton repository. For that reason, I would simply copy the skeleton files and adds them anew to each client repository:

$ unzip skeleton.zip
$ rm skeleton.zip
$ hg add
$ hg commit -m "Initialized repository for client-a"

Since the date and commit message will be different for each client, the repositories will become unrelated and hg push and hg pull will then error out if you try to mix changesets from different clients.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文