diff mercurial/commands.py @ 5230:bfd73b567b3d

When reverting a file which was renamed, also revert the old name
author Brendan Cully <brendan@kublai.com>
date Wed, 29 Aug 2007 16:15:23 -0700
parents 20817af258d8
children d59ed18ec2d0 cba2a689117d
line wrap: on
line diff
--- a/mercurial/commands.py	Mon Aug 27 14:21:04 2007 -0300
+++ b/mercurial/commands.py	Wed Aug 29 16:15:23 2007 -0700
@@ -2338,6 +2338,14 @@
     changes = repo.status(match=names.has_key, wlock=wlock)[: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][0] == 'r':
+            removed[src] = None
+            names[src] = (repo.pathto(src, cwd), True)
+
     revert = ([], _('reverting %s\n'))
     add = ([], _('adding %s\n'))
     remove = ([], _('removing %s\n'))