Question about Source Control

Cameron Simpson cs at
Sat Mar 22 03:49:33 CET 2014

On 22Mar2014 09:17, Chris Angelico <rosuav at> wrote:
> On Sat, Mar 22, 2014 at 8:32 AM, Cameron Simpson <cs at> wrote:
> > Basicly, run "hg log" for the file, and examine each of the diffs
> > WRT to your target line.
> >
> > Refactoring raises the bar somewhat.
> Here's one where git and hg are a lot more different.

You might find it is just a matter of knowing what tool to use.

> When I'm trying to find the origin of some line of code in a git repo,
> I often make a dummy edit to it, then pull up gitk, right-click the
> red "deleted" line, and hit "Show origin of this line". This will
> select the commit that introduced that one line, without annotating
> the whole rest of the file (often a slow job, especially on a big
> file), and then I can go from the green inserted line to the
> corresponding red deleted line and repeat the exercise (eg if some
> trivial change was made, like renaming something). I'm trying that
> workflow with "hg view", the nearest equivalent to gitk, but it's way
> slower and doesn't seem to have a right-click menu at all, so I'm not
> sure this is possible. Is there a convenient way to trace the origin
> of one line back through a few commits?

I don't know.

You might do better to ask this kind of question on the mercurial list:

Someone there is bound to have wanted to do this kind of thing, and
may know if there's a tool or extension that makes it easy. There's
a whole expression syntax for getting mercurial to select from the
revision tree, for example; I do not know if it is applicable in
this case.

Cameron Simpson <cs at>

Do what you think is interesting, do something that you think is fun
and worthwhile, because otherwise you won't do it well anyway.
- Brian Kernighan

More information about the Python-list mailing list