gpt4 book ai didi

mercurial - 如何使 Mercurial 子存​​储库始终指向某个变更集或标签?

转载 作者:行者123 更新时间:2023-12-04 08:45:44 24 4
gpt4 key购买 nike

我很好奇 Mercurial 是否可以做到这一点。我想在一个项目中有一个子存储库,它总是固定到手动指定的变更集,或者更好的是 - 标记。

基本上我想要实现的是在主仓库中有一个核心系统,然后是子仓库中的所有模块和组件,但我不希望这些子仓库指向小费,只指向这些组件/模块的主要版本(因此标签)。

最佳答案

子存储库完全按照您的意愿工作。

Mercurial 永远不会自动将 subrepo 更新为小费。它始终停留在您选择的变更集上。来自 documentation :

Subrepos don't automatically track the latest changeset of their sources. Instead, they are updated to the changeset that corresponds with the changeset checked out in the top-level changeset. This is so developers always get a consistent set of compatible code and libraries when they update.



要实现您想要的,您可以按照以下步骤操作:
  • echo subrepo = https://example.com/subrepo/repo/path > .hgsub
  • hg add .hgsub
  • hg clone https://example.com/subrepo/repo/path subrepo
  • hg -R subrepo update mytag
  • hg commit

  • 这将创建一个包含指定存储库内容的子存储库目录,该存储库将保留在 mytag 上。标签只要不更新 手动 到别的东西!

    克隆您的存储库的每个人都将拥有与您相同的变更集的子存储库(即 mytag )。

    仅供引用,子存储库更新到的变更集存储在 .hgsubstate文件位于主存储库的根目录。

    关于mercurial - 如何使 Mercurial 子存​​储库始终指向某个变更集或标签?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8541928/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com