我最近在跟踪负责源文件中特定行的变更集时遇到了问题。 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