Question about Source Control

Cameron Simpson cs at
Fri Mar 21 22:32:36 CET 2014

On 21Mar2014 08:23, Roy Smith <roy at> wrote:
> In article <mailman.8348.1395381664.18130.python-list at>,
>  Cameron Simpson <cs at> wrote:
> >   hg blame bin/set-x
> > 
> > and the output goes:
> > 
> >     [hg/css]fleet*> hg blame bin/set-x
> >      2186: #!/bin/sh
> >     11359: #
> >     11359: # Trace execution of a command.
> There's two things hg blame doesn't do which would be useful.
> First, the trivial one.  I don't want lines annotated by change number, 
> I want them annotated by the name of the person who checked it in.

From "hg help blame":

  This command is useful for discovering when a change was made and by whom.

Look at "hg blame -u" or "hg blame -uv".

> The hard thing is I don't really want to know which change most recently 
> touched the line of text.  I want to know who really wrote it.  It would 
> be wonderful if hg were smart enough to be able to back-track through 
> the change history and ignore trivial changes like whitespace, 
> refactoring a function out of one file into another, etc.  That's the 
> real meat and potatoes of "blame".  I want to know who I need to hit 
> over the head with a clue-by-four once I fix a bug.

That would probably be not too hard to script. The tricky bit might be
identifying a particular line as the same over certain diffs.

Basicly, run "hg log" for the file, and examine each of the diffs
WRT to your target line.

Refactoring raises the bar somewhat.

Cameron Simpson <cs at>

I am learning that criticism is not nearly as effective as sabotage.
        - Shanti Goldstein

More information about the Python-list mailing list