changeset 5266:d59ed18ec2d0

Merge with crew-stable
author Brendan Cully <brendan@kublai.com>
date Wed, 29 Aug 2007 16:19:27 -0700
parents 15a108ad7adb (current diff) bfd73b567b3d (diff)
children b817d17c7ee5
files mercurial/commands.py
diffstat 3 files changed, 16 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Tue Aug 28 23:02:41 2007 -0300
+++ b/mercurial/commands.py	Wed Aug 29 16:19:27 2007 -0700
@@ -2330,6 +2330,14 @@
         changes = repo.status(match=names.has_key)[:5]
         modified, added, removed, deleted, unknown = map(dict.fromkeys, changes)
 
+        # if f is a rename, also revert the source
+        cwd = repo.getcwd()
+        for f in added:
+            src = repo.dirstate.copied(f)
+            if src and src not in names and repo.dirstate[src] == 'r':
+                removed[src] = None
+                names[src] = (repo.pathto(src, cwd), True)
+
         revert = ([], _('reverting %s\n'))
         add = ([], _('adding %s\n'))
         remove = ([], _('removing %s\n'))
--- a/tests/test-revert	Tue Aug 28 23:02:41 2007 -0300
+++ b/tests/test-revert	Wed Aug 29 16:19:27 2007 -0700
@@ -94,4 +94,9 @@
 hg revert b newdir
 echo foobar > b/b
 hg revert .
-true
+
+echo % reverting a rename target should revert the source
+hg mv a newa
+hg revert newa
+hg st a newa
+
--- a/tests/test-revert.out	Tue Aug 28 23:02:41 2007 -0300
+++ b/tests/test-revert.out	Wed Aug 29 16:19:27 2007 -0700
@@ -63,3 +63,5 @@
 reverting b/b
 forgetting newdir/newfile
 reverting b/b
+% reverting a rename target should revert the source
+? newa