status: revert + flag-change == modified
authorMartin von Zweigbergk <martinvonz@google.com>
Mon, 04 Jan 2016 09:44:58 -0800
changeset 27668 369c8f9453c2
parent 27667 37df458d60c2
child 27669 b1824a1725ed
status: revert + flag-change == modified After just changing the flag on a file, plain 'hg status' will report the file as modified. However, after reverting a file to a previous revision's state and changing the flag, it will be reported as clean. Fix by comparing the flags that were previously ignored in context._buildstatus().
mercurial/context.py
tests/test-status.t
--- a/mercurial/context.py	Tue Jan 05 20:52:34 2016 -0800
+++ b/mercurial/context.py	Mon Jan 04 09:44:58 2016 -0800
@@ -144,6 +144,8 @@
                 # The file was not a new file in mf2, so an entry
                 # from diff is really a difference.
                 modified.append(fn)
+            elif flag1 != flag2:
+                modified.append(fn)
             elif self[fn].cmp(other[fn]):
                 # node2 was newnode, but the working file doesn't
                 # match the one in mf1.
--- a/tests/test-status.t	Tue Jan 05 20:52:34 2016 -0800
+++ b/tests/test-status.t	Mon Jan 04 09:44:58 2016 -0800
@@ -362,6 +362,34 @@
 
   $ cd ..
 
+hg status with --rev and reverted changes:
+
+  $ hg init reverted-changes-repo
+  $ cd reverted-changes-repo
+  $ echo a > file
+  $ hg add file
+  $ hg ci -m a
+  $ echo b > file
+  $ hg ci -m b
+
+reverted file should appear clean
+
+  $ hg revert -r 0 .
+  reverting file
+  $ hg status -A --rev 0
+  C file
+
+#if execbit
+reverted file with changed flag should appear modified
+
+  $ chmod +x file
+  $ hg status -A --rev 0
+  M file
+
+#endif
+
+  $ cd ..
+
 hg status of binary file starting with '\1\n', a separator for metadata:
 
   $ hg init repo5