带有 MQ 的 Mercurial 子存​​储库

发布于 2024-10-09 17:44:39 字数 1017 浏览 2 评论 0原文

有时,当我进行代码更改时,我需要对我的存储库中的共享库代码进行相应的更改,该存储库本身就是一个子存储库。当我想要提交更改时,我在父存储库中执行此操作,Mercurial 负责在子存储库中执行相应的提交。

不过,我最近开始使用 MQ 来更好地跟踪自己的变更历史,并给自己更多的自由来进行实验并更安全地进行大规模重构工作。我在父存储库和子存储库上都启用了 MQ。

在上述场景中,如果我“提交”新的或现有的 MQ 补丁,那么子存储库将被忽略,我的假设是否正确?这就是我的测试中似乎发生的情况。这是否意味着我需要手动管理子存储库中的补丁队列?这很快就会变得难以处理。

如果这不起作用,那很好 - 当我有跨存储库工作要做时,我可以调整我的工作流程并避免使用 MQ - 但我想知道我是否遗漏了某些内容,或者其他人是否有可以分享的针对此场景的解决方案。


更新:根据此线程,目前这可能“不受支持”:https://www.mercurial-scm.org/bts/issue2499

我尝试了以下操作:

  1. 手动提交子存储库更改。
  2. 使用子存储库提交中的哈希值手动更新父存储库中的 .hgsubstate 文件。
  3. 尝试刷新父存储库。

我的想法是,我可以从父存储库获取提交,以便始终与正确的子存储库版本同步,即使我必须手动执行此操作。不幸的是,Mercurial 似乎想在这里保护我(因为它应该如此!),并在我尝试 qrefresh 时抛出以下内容:

warning: not refreshing .hgsubstate

为了“修复”某些内容,我在父存储库上的 hgfinish 之后执行了一个空提交,以使内容同步回来向上。但是......这看起来很愚蠢,并且使代码历史更难理解。

哦,好吧,我想我会回到石器时代,当涉及到子存储库时,我会停止在工作流程中使用 MQ。

Sometimes when I am working on a code change, I need to make a corresponding change to the shared library code in my repository, which is itself a subrepository. When I want to commit the changes, I do so in the parent repository and Mercurial takes care of doing the coresponding commit in the subrepo.

However, I recently started using MQ to better track my own change history and give myself some more freedom to experiment and do large-scale refactoring work more safely. I have MQ enabled on both the parent and subrepo.

In the scenario describe above, am I correct in assuming that if I 'commit' to a new or existing MQ patch, then the subrepo gets ignored? This is what seems to happen in my testing. Does this mean I need to manually manage the patch queue in the subrepo? This gets unwieldy very quickly.

If this doesn't work, that's fine - I can adjust my workflow and avoid MQ when I have cross-repo work to do - but I wonder if I'm missing something or if others have a solution to this scenario they could share.


Update: Seems like this may be 'unsupported' at this point according to this thread: https://www.mercurial-scm.org/bts/issue2499

I tried the following:

  1. Committed the subrepo change manually.
  2. Updated the .hgsubstate file in the parent repository manually with the hash from the subrepo commit.
  3. Tried to qrefresh the parent repository.

The idea was that I could get the commit from the parent repository to always sync with the right subrepo version, even if I had to do it manually. Unfortunately Mercurial seems to want to protect me here (as it should!) and pits out the following when I try to qrefresh:

warning: not refreshing .hgsubstate

In order to 'fix' things I do an empty commit after the hgfinish on the parent repository to get things synced back up. But... that seems silly and makes the code history harder to grok.

Oh well, guess I'll go back to the stone age and stop using MQ in my workflow when there are sub-repositories involved.

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

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

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文