context: check for differing flags a little earlier
authorMartin von Zweigbergk <martinvonz@google.com>
Tue, 12 Jan 2016 13:10:31 -0800
changeset 27749 215b47449e47
parent 27748 81b391a45264
child 27750 443848eece18
context: check for differing flags a little earlier This makes it clearer that a unchanged file whose flags have changed will be reported as a modification. Also test this.
mercurial/context.py
tests/test-status.t
--- a/mercurial/context.py	Tue Jan 12 13:09:54 2016 -0800
+++ b/mercurial/context.py	Tue Jan 12 13:10:31 2016 -0800
@@ -140,14 +140,14 @@
                 added.append(fn)
             elif node2 is None:
                 removed.append(fn)
+            elif flag1 != flag2:
+                modified.append(fn)
             elif self.rev() is not None:
                 # When comparing files between two commits, we save time by
                 # not comparing the file contents when the nodeids differ.
                 # Note that this means we incorrectly report a reverted change
                 # to a file as a modification.
                 modified.append(fn)
-            elif flag1 != flag2:
-                modified.append(fn)
             elif self[fn].cmp(other[fn]):
                 modified.append(fn)
             else:
--- a/tests/test-status.t	Tue Jan 12 13:09:54 2016 -0800
+++ b/tests/test-status.t	Tue Jan 12 13:10:31 2016 -0800
@@ -388,6 +388,17 @@
 
   $ hg revert -r 0 .
   reverting file
+
+reverted and committed file with changed flag should appear modified
+
+  $ hg co -C .
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  $ chmod +x file
+  $ hg ci -m 'change flag'
+  $ hg status -A --rev 1 --rev 2
+  M file
+  $ hg diff -r 1 -r 2
+
 #endif
 
 hg status of binary file starting with '\1\n', a separator for metadata: