Mercurial 嵌套子存储库(子存储库中的子存储库)不递归提交?

发布于 2024-09-06 20:42:51 字数 635 浏览 4 评论 0原文

我有一个像这样设置的 Mercurial 存储库,在另一个子存储库中包含一个子存储库:

Root 
  .hg 
  .hgsub 
  .hgsubstate 
  Nested
    .hg 
    .hgsub 
    .hgsubstate 
    foo.txt 
    FurtherNested 
     .hg 
     bar.txt

如果我更改 foo.txt 和 bar.txt 并从根内部提交,那么一切都很好,所有嵌套的子存储库都会提交。但是,如果我只更改 bar.txt 并从 Root 提交,那么 Hg 认为没有任何更改。当 Furnested 中只有更改时,我必须从 Nested 内部提交才能获取要提交的 Furnested 更改。似乎为了使嵌套子存储库起作用,每个嵌套级别都必须包含更改才能使递归起作用。

我在 Mercurial 文档中读到的关于子存储库的内容似乎都没有暗示子存储库提交只有在发生更改时才会传播。事实上,它说的是相反的:

当我们提交时,Mercurial 将尝试 递归地提交所有定义的 子存储库...

所以我的问题是,这是预期的还是有问题或者尚未完成(Windows 上的 Mercurial 1.5.4)?

I've got a Mercurial repo set up like this, with a subrepo inside another subrepo:

Root 
  .hg 
  .hgsub 
  .hgsubstate 
  Nested
    .hg 
    .hgsub 
    .hgsubstate 
    foo.txt 
    FurtherNested 
     .hg 
     bar.txt

If I change foo.txt and bar.txt and commit from inside Root then all is well and all the nested subrepos commit. However if I only change bar.txt and commit from Root then Hg thinks nothing is changed. I have to commit from inside Nested to get the FurtherNested changes to commit when there are only changes in FurtherNested. It seems that in order for nested subrepos to work, each nested level has to contain changes in order for the recursion to work.

Nothing I read in the Mercurial docs on subrepos seemed to imply that subrepo commits would only propagate if there were changes. In fact it says the opposite:

When we commit, Mercurial will attempt
to recursively commit in all defined
subrepos...

So my question is, is this to be expected or is something broken or just not done yet (Mercurial 1.5.4 on Windows)?

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

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

发布评论

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

评论(1

往日情怀 2024-09-13 20:42:51

在我看来,这只是一个坏掉的东西。相关源代码(在 subrepo.py 中)似乎没有递归到 subsubrepos 中,即:

def dirty(self):
    r = self._state[1]
    if r == '':
        return True
    w = self._repo[None]
    if w.p1() != self._repo[r]: # version checked out change
        return True
    return w.dirty() # working directory changed

可能不会太难修复,尽管我还不太了解代码。可能值得在 Mercurial 邮件列表 上发帖和/或提交错误。我怀疑马特和伯努瓦正在读这篇文章,但他们确实阅读了那里发布的所有内容。

Looks to me like this is just something that's broken. The relevant source code (in subrepo.py) doesn't seem to recurse into subsubrepos, viz:

def dirty(self):
    r = self._state[1]
    if r == '':
        return True
    w = self._repo[None]
    if w.p1() != self._repo[r]: # version checked out change
        return True
    return w.dirty() # working directory changed

Probably wouldn't be too hard to fix, though I don't know the code intimately enough yet. It would probably be worthwhile posting on the Mercurial mailing list and/or filing a bug. I doubt Matt and Benoit are reading this, but they definitely do read everything posted there.

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