Mercurial 注释/责备给出了错误的原始修订

标签 mercurial blame

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

相关文章:

version-control - 提交和推送单个文件同时保留其他修改的最简单方法是什么?

git - 使用 Intellij 和 git 在注释模式下忽略空格/缩进

mercurial - hg分支的两个变更集之间的日志

mercurial - 使用 Mercurial,如何在推送之前将一系列变更集 "compress" merge 为一个?

svn - 不会清除svn责备的样式清理?

svn - 如何 svn 注释/归咎于已删除的文件?

git blame 一行修改多次?

git - 告诉 git-blame 使用导入的历史记录

linux - 使用python中的子进程在linux终端上执行命令

version-control - 如何获取按最近使用顺序排列的 Mercurial (hg) 书签列表?