在 Mercurial 中,一条线如何在不合并的情况下消失?

发布于 2025-01-03 00:48:50 字数 831 浏览 0 评论 0原文

使用 Mercurial,我遇到了一个奇怪的问题,其中一个提交者的一行在时间线的某个时刻消失了,我无法解释为什么会这样。

日志如下所示:

changeset:   172:xyz123
parent:      76:pqr345
user:        barry baggings
date:        Mon Jan 16 0:12:43 2012 +0000
summary:     blah blah blah

changeset:   171:opq123
parent:      165:abc234
user:        mary moggings
date:        Mon Feb 01 1:12:41 2012 +0000
summary:     naw naw naw

运行: hg diff -r 171 -r 172 为 abc.py 提供此信息(省略标头):

print "context line1"
- print "i need this line!"
print "context line2"

有问题的 mod print "我需要这一行! 肯定是在 171:opq123 中引入的,但在 172:xyz123 中又消失了,

但是 76 和 172 之间的差异显示 abc.py 没有 mods!跳跃玛丽的改变是这样的吗?

如何工作的吗?我在 CVS 和 SVN 等方面有相当不错的背景,但 DVCS 有时让我头疼……有人可以解释一下吗?

我只是误解了这一切是 re on Mercurial 1.7.1 - 这可能是一个错误吗?

Using mercurial, I've run into an odd problem where a line from one committer vanished at some point in the timeline and I can't explain why it is.

Log looks like this:

changeset:   172:xyz123
parent:      76:pqr345
user:        barry baggings
date:        Mon Jan 16 0:12:43 2012 +0000
summary:     blah blah blah

changeset:   171:opq123
parent:      165:abc234
user:        mary moggings
date:        Mon Feb 01 1:12:41 2012 +0000
summary:     naw naw naw

Running: hg diff -r 171 -r 172 gives this for abc.py (header omitted):

print "context line1"
- print "i need this line!"
print "context line2"

The mod in question print "i need this line! was definitely introduced in 171:opq123 but it's gone again in 172:xyz123,

But a diff between 76 and 172 shows no mods to abc.py! How can Barry leapfrog Mary's change like this?

Am I just misunderstanding how all this works? I have a pretty decent background in things like CVS and SVN but DVCSs make my head hurt sometimes... can someone explain?

I am slightly suspicious that it's because we're on mercurial 1.7.1 - could it be a bug?

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

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

发布评论

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

评论(1

逆流 2025-01-10 00:48:50

这些是单独的头,其中 172 不是基于 171。该图表是在启用 graphlog 扩展并运行 hg glog 时生成的,或者如果运行 则可以从 hgweb 中直观地看到hgserve,在浏览器中打开它并单击“图表”链接,显示它可能比变更集的“父”值更清楚。

o    changeset:   172:xyz123
|    parent:      76:pqr345
|    user:        barry baggings
|    date:        Mon Jan 16 0:12:43 2012 +0000
|    summary:     blah blah blah
|    
| o  changeset:   171:opq123
| |  parent:      165:abc234
| |  user:        mary moggings
| |  date:        Mon Feb 01 1:12:41 2012 +0000
| |  summary:     naw naw naw
| |

这清楚地表明变更集 172 并非基于变更集 171。因此,在比较它们时,变更可能发生在其他地方。你不是在比较祖先和后代,而是在某种程度上比较表兄弟姐妹。

所以,虽然你在171中引入了它,但由于172不是基于171,所以它没有得到该行的添加。事实上,您需要合并来获取更改,以创建基于 171 和 172(以及它们的祖先,直到它们收敛)的变更集。

您很可能有更多想要合并的头;您可以使用 hg Heads 来查看它们。 hgserve 对于理解这些事情也非常有帮助。

These are separate heads, with 172 not based on 171. The graph, as produced if you have the graphlog extension enabled and run hg glog, or as you can see visually from hgweb if you run hg serve, open it in a browser and click on the "graph" link, shows it perhaps more clearly than the "parent" values of the changesets.

o    changeset:   172:xyz123
|    parent:      76:pqr345
|    user:        barry baggings
|    date:        Mon Jan 16 0:12:43 2012 +0000
|    summary:     blah blah blah
|    
| o  changeset:   171:opq123
| |  parent:      165:abc234
| |  user:        mary moggings
| |  date:        Mon Feb 01 1:12:41 2012 +0000
| |  summary:     naw naw naw
| |

This shows clearly that changeset 172 is not based on changeset 171.Thus in comparing them, the change can have taken place elsewhere. You're not comparing an ancestor and descendant, you're comparing cousins of some degree.

So, while you introduced it in 171, because 172 is not based on 171, it doesn't get the addition of the line. A merge is in fact what you need to get the change, to make a changeset which is based both on 171 and 172 (and their ancestors, until they converge).

You may well have more heads that you want merged in; you can use hg heads to look at them. hg serve can also be very helpful for comprehending such things.

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