我最近在追踪源文件中特定行的变更集时遇到了问题。 hgblame
给了我一个从未 merge 到我感兴趣的分支中的修订版。
我发现,如果之前进行了类似的不相关更改,Mercurial 仍会将其显示为原始修订版。这是一个错误还是它应该像这样表现?如果是后者,您能解释一下原因吗?
这是最小的示例:
hg init test
cd test
# Create a new file that has 3 lines
echo "111\n222\n333" > test.txt
hg commit -Am "Original file"
# Append "444" to the file
echo "444" >> test.txt
hg commit -m "Abandoned change"
# Go back to the first revision and append the same "444" to the file
hg up 0
echo "444" >> test.txt
hg commit -m "Actual change"
这是存储库的样子:
$ hg glog
@ changeset: 2:1b16b07e058e
| tag: tip
| parent: 0:e58635de081c
| user: Nobody <nobody@nowhere.org>
| date: Tue Nov 20 17:17:41 2012 +0100
| summary: Actual change
|
| o changeset: 1:b02ee64b2e2d
|/ user: Nobody <nobody@nowhere.org>
| date: Tue Nov 20 17:17:41 2012 +0100
| summary: Abandoned change
|
o changeset: 0:e58635de081c
user: Nobody <nobody@nowhere.org>
date: Tue Nov 20 17:17:41 2012 +0100
summary: Original file
现在,当我运行 hg Britain
时,我希望看到最后一行来自变更集 2,而不是变更集 1。
$ hg blame test.txt
0: 111
0: 222
0: 333
1: 444
最佳答案
这不是预期的行为,您遇到了 Bug 1839 .
关于Mercurial 注释/责备给出了错误的原始修订,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13477681/