mercurial

Mercurial: annotate / blame current line number


hg annotate -unl aFile

Shows:

jim 1519:477:     a = 4
bob 1518:468:     b = 5
joe 1496:402:     return a

How do I get it to show

jim 401:     a = 4
bob 402:     b = 5
joe 403:     return a

Where 401, 402, 403 are the current line numbers. Better yet would be something like git has with git blame -L 401,403 aFile.


Solution

  • To show current line numbers:

    hg annotate -u aFile | cat -n
    

    To also select only a certain range of line numbers:

    hg annotate -u aFile | cat -n | sed -n 401,403p