Mercurial特定行号的行走历史

时间:2013-08-15 16:46:42

标签: version-control mercurial history annotate

我需要使用命令行(没有GUI工具)将Mercurial的历史记录用于从历史到起点的单个行号。作为一个例子,我将这用于Git(使用git blame)第2行:

git blame -L2,2 --porcelain --incremental Filename.txt HEAD

d1b92f3a9e31ca3e3ee56f0965609314fc192f22 2 2 1  (<- the first 2 listed is the previous line number)
author Firstname Lastname
author-mail <author@domain.com>
author-time 1140197028
author-tz +0000
committer Firstname Lastname
committer-mail <author@domain.com>
committer-time 1140197028
committer-tz +0000
summary commit message here
previous 6bbaa283b326cde510ea3146a5fc6edd8956489a Filename.txt
filename Filename.txt

我需要以下信息:

  • 提交者/作者姓名
  • 上一个行号
  • 日期和时间
  • 上一个哈希

使用git blame,我可以使用这些信息并再次调用它来获取特定的哈希值和前一个行号,从而遍历该行的整个历史记录。

对于Mercurial,我找到了hg annotate。我有以下内容:

hg annotate -unlcv -r tip Filename.txt | cat -n | sed -n 2,2p

2 Firstname Lastname <author@domain.com> 24741 7c36d9284795: 2: commit message here

所以这很好。我可以获得我需要的所有信息,包括最后一个哈希,除了我不确定前一个行号。上面列出的前两行来自“cat”,但是第二个列出的2 ...是我应该遵循的前一个行号?我想确保我正确地追溯历史。

0 个答案:

没有答案
相关问题