How do I find out who is responsible for a specific line of code? I know the linenumber and the filename but I would like Mercurial to tell me the author(s) of that specific lin
I was a fan of "svn blame"
, so I've added to my ~/.hgrc
:
[alias]
blame = annotate --user --number
so I can just type "hg blame"
;-)
On the command-line, you'd want to use hg annotate -u
(-u
can be combined with -n
to get the local revision number, which might come in useful). Check hg help anno
for more options.
I looked for this for ages in Tortoise Workbench; thanks to @artemb and @Steve Pitchers for pointing me in the right direction. Still took me a while to spot it.
If you are using TortoiseHG
hgtk annotate <filename>
Or by finding the file in the log, rightclicking it and selecting "Annotate file"
In tortoisehg annotate window, there is a new context menu to enable this.
see https://bitbucket.org/tortoisehg/thg/issues/1861/annotate-window-annotate-with-authors
on the command line , you can use either hg blame or hg annotate.
$ hg blame -u -c -l Filename
-u --user list the author (long with -v)
-c --changeset list the changeset
-l --line-number show line number at the first appearance