hg clone src#tag dest 的问题

发布于 2024-10-06 18:30:15 字数 1515 浏览 0 评论 0原文

我有一个名为 master 的存储库,用于保存产品版本。它有几个标签(如1.0、2.0、3.0)作为基线。当我想为一个版本(例如 1.0.1)创建修补程序时。我使用命令如下:

hg clone master#1.0 hotfix_1.0.1
cd hotfix_1.0.1
hg tip

changeset:   14:b2492c2611a1
tag:         tip
user:        codingboy <[email protected]>
date:        Thu Dec 09 14:03:23 2010 +0800
summary:     fix bug4

我发现提示版本是我需要的,但没有标记为 1.0。这会导致我在hotfix_1.0.1中的更改​​无法推送到master。错误是

(abort) unknown 1.0 revision.

我检查主存储库。日志显示如下

changeset:   15:3497c46cbc7f
tag:         tip
user:        codingboy <[email protected]>
date:        Thu Dec 09 14:03:27 2010 +0800
summary:     Added tag 1.0 for changeset b2492c2611a1

changeset:   14:b2492c2611a1
tag:         1.0
user:        codingboy <[email protected]>
date:        Thu Dec 09 14:03:23 2010 +0800
summary:     fix bug4

,看来克隆存储库丢失了 changset#15。我的理解是 hg clone src#tag dest 应该克隆我需要的标签。但此操作无法克隆进行标记的变更集#14 的子级。所以我所做的就是使用命令

hg clone master hotfix_1.0.1 -u 1.0

我不喜欢这个命令。如果主存储库很大并且我只想修复旧版本,那么克隆和推送更改会浪费时间。

我是否有其他方法可以从一个基线或标签正确克隆一个存储库?

谢谢...

I have a repository named master which keeps product releases. It has several tags (such as 1.0,2.0,3.0) as baseline. When I want to create hot fix for one version, for example 1.0. I use command as following:

hg clone master#1.0 hotfix_1.0.1
cd hotfix_1.0.1
hg tip

changeset:   14:b2492c2611a1
tag:         tip
user:        codingboy <[email protected]>
date:        Thu Dec 09 14:03:23 2010 +0800
summary:     fix bug4

I find tip version is what I need, but is not tagged with 1.0. It will cause my changes in hotfix_1.0.1 can not be push to master. the error is

(abort) unknown 1.0 revision.

I check master repository. the log shows below

changeset:   15:3497c46cbc7f
tag:         tip
user:        codingboy <[email protected]>
date:        Thu Dec 09 14:03:27 2010 +0800
summary:     Added tag 1.0 for changeset b2492c2611a1

changeset:   14:b2492c2611a1
tag:         1.0
user:        codingboy <[email protected]>
date:        Thu Dec 09 14:03:23 2010 +0800
summary:     fix bug4

so it seems cloned repository lost changset#15. My understanding is hg clone src#tag dest should clone tag which I need. But this operation can not clone child of changeset#14 which is do tagging. So what I have done is to use command

hg clone master hotfix_1.0.1 -u 1.0

I do not like this command. if master repository is huge and I just want to fix old version, It will waste time to clone and push changes.

Do I have any other approach to clone one repository from one baseline or tag correctly?

thanks...

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

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

发布评论

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

评论(1

把梦留给海 2024-10-13 18:30:15

由于 Mercurial 标签的设计,带标签的修订版不包含该标签。换句话说,1.0 并不“知道”它是 1.0。

Mercurial 推荐您最后给出的解决方案。缓解性能问题的一个可能方法是保留(根据需要拉取)不修改的 master 的单个克隆。然后,(根据需要)在本地克隆该文件并更新到所需的版本。克隆将(假设具有相同的卷和现代文件系统)使用硬链接,最大限度地减少所需的复制。

Due to the design of Mercurial tags, the tagged revision does not contain that tag. In other words, 1.0 doesn't "know" it's 1.0.

Mercurial recommends the solution you give at the end. A possible mitigation for the performance issues is to keep (pulling as needed) a single clone of master that you don't modify. Then, (as needed) clone that locally and update to the desired version. The clone will (assuming same volume and a modern filesystem) use hard links, minimizing the required copying.

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