Clean way of extracting rename information from mercurial

Brendan Cully brendan at kublai.com
Wed Nov 28 11:31:03 CST 2007


On Wednesday, 28 November 2007 at 12:27, Yaron Minsky wrote:
> On Wed, 2007-11-28 at 08:45 -0800, Brendan Cully wrote:
> > On Wednesday, 28 November 2007 at 09:06, Yaron Minsky wrote:
> > > Is there a nice way to ask mercurial how files have been renamed between
> > > two revisions?  The reason for the question is that we're trying to put
> > > together a diff tool that is intelligent about renames, but for now, the
> > > only way we've managed to get our hands on the data is to parse through
> > > the output of "hg diff --git", which is somewhat error prone.
> > 
> > you can use hg status -arC --rev <old>:<new>
> 
> I just created a repo with a single file "foo" and then renamed it to
> bar.  The result of the command you proposed is as follows:
>         
>         [12:25:02 yminsky at nyc-qws-015 foo]$ hg status -arC --rev 0:1
>         A bar
>         R foo
> 
> That looks like bar was added and foo was removed.  I'm not sure how I
> can detect that bar is actually a copy of foo from this.

Hmm. -C is supposed to provide copy information, so you'd see

A bar
  foo
R foo

indicating that bar was added as a copy of foo and foo was removed.

It looks like a bug in status to me.


More information about the Mercurial mailing list