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 line of code. Is there a command for that?
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 line of code. Is there a command for that?
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 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" ;-)
If you are using TortoiseHG
hgtk annotate <filename>
Or by finding the file in the log, rightclicking it and selecting "Annotate file"
You can also try:
hg blame <file name> | grep -A10 -B10 "<piece of code from the line of interest>"
It will show who made the change to the line, including 10 lines above and 10 lines below the line you are interested in.