diff mercurial/commands.py @ 6299:653ddd1d7cd7

revert: update state of files in the "checkout" list This can make a difference when there are filters involved and decode(encode(working-dir-data)) != working-dir-data even though encode(decode(repo-data)) == repo-data An example is a working dir file that uses only \n when you're using the win32text extension.
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Tue, 18 Mar 2008 04:07:39 -0300
parents a9e6b8875805
children d99b4e8652b3
line wrap: on
line diff
--- a/mercurial/commands.py	Tue Mar 18 04:07:39 2008 -0300
+++ b/mercurial/commands.py	Tue Mar 18 04:07:39 2008 -0300
@@ -2380,8 +2380,19 @@
                     pass
                 repo.dirstate.remove(f)
 
+            normal = None
+            if node == parent:
+                # We're reverting to our parent. If possible, we'd like status
+                # to report the file as clean. We have to use normallookup for
+                # merges to avoid losing information about merged/dirty files.
+                if p2 != nullid:
+                    normal = repo.dirstate.normallookup
+                else:
+                    normal = repo.dirstate.normal
             for f in revert[0]:
                 checkout(f)
+                if normal:
+                    normal(f)
 
             for f in add[0]:
                 checkout(f)