mercurial/commands.py
changeset 5263 d59ed18ec2d0
parent 5255 65dc707606ed
parent 5262 bfd73b567b3d
child 5300 81575b7b505e
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -2330,6 +2330,14 @@ def revert(ui, repo, *pats, **opts):
         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'))