Finding the author of a line of code in Mercurial

前端 未结 6 1514
时光说笑
时光说笑 2021-01-30 03:10

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

相关标签:
6条回答
  • 2021-01-30 03:13

    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" ;-)

    0 讨论(0)
  • 2021-01-30 03:24

    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.

    0 讨论(0)
  • 2021-01-30 03:24

    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.

    enter image description here

    0 讨论(0)
  • 2021-01-30 03:37

    If you are using TortoiseHG

    hgtk annotate <filename>
    

    Or by finding the file in the log, rightclicking it and selecting "Annotate file"

    0 讨论(0)
  • 2021-01-30 03:38

    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

    0 讨论(0)
  • 2021-01-30 03:38

    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
    
    0 讨论(0)
提交回复
热议问题