Showing renames in hg status?

There are several ways to do this.

Before you commit, you can use hg diff --git to show what was renamed:

$ hg diff --git
diff --git a/theTest.txt b/aTest.txt
rename from theTest.txt
rename to aTest.txt

Note that this only works if you used hg mv, hg rename, or mv and hg addremove --similarity 100.

After you commit, you can still use hg diff, but you’ll have to specify the change using -r:

$ hg diff -r 0 -r 1 --git
diff --git a/test.txt b/theTest.txt
rename from test.txt
rename to theTest.txt

For both hg status and hg log, use the -C command-line flag to see the source that a file was copied from.

$ hg status -C
A aTest.txt
  theTest.txt
R theTest.txt

The line just below aTest.txt indicates the source it was copied from (theTest.txt).

$ hg log -v -C
changeset:   1:4d7b42489d9f
tag:         tip
user:        jhurne
date:        Tue Apr 20 20:57:07 2010 -0400
files:       test.txt theTest.txt
copies:      theTest.txt (test.txt)
description:
Renamed test.txt

You can see the files that were affected (test.txt and theTest.txt), and that “theTest.txt” was copied from test.txt.

Leave a Comment

tech