我最近在跟踪负责源文件中特定行的变更集时遇到了问题。hg blame
给了我一个从未合并到我感兴趣的分支中的修订。
我发现,如果之前进行了类似的不相关更改,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 blame
我希望看到最后一行来自变更集 2,而不是变更集 1。
$ hg blame test.txt
0: 111
0: 222
0: 333
1: 444