changeset 23731:ccbaa2ed11a4

status: don't list files as both clean and deleted Tracked files that are deleted should always be reported as such, no matter what their state was in earlier revisions. This is encoded in in two conditions in the loop in basectx._buildstatus() for modified and added files, but the check is missing for clean files. We should check for clean files too, but instead of adding the check in a third place, move it earlier and skip most of the loop body for deleted files.
author Martin von Zweigbergk <martinvonz@google.com>
date Mon, 05 Jan 2015 17:12:04 -0800
parents 4b56219a5ac2
children c51d6c043bb1
files mercurial/context.py tests/test-status-rev.t
diffstat 2 files changed, 5 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/context.py	Mon Jan 05 16:52:12 2015 -0800
+++ b/mercurial/context.py	Mon Jan 05 17:12:04 2015 -0800
@@ -140,16 +140,17 @@
         deletedset = set(deleted)
         withflags = mf1.withflags() | mf2.withflags()
         for fn, mf2node in mf2.iteritems():
+            if fn in deletedset:
+                continue
             if fn in mf1:
-                if (fn not in deletedset and
-                    ((fn in withflags and mf1.flags(fn) != mf2.flags(fn)) or
+                if ((fn in withflags and mf1.flags(fn) != mf2.flags(fn)) or
                      (mf1[fn] != mf2node and
-                      (mf2node != _newnode or self[fn].cmp(other[fn]))))):
+                      (mf2node != _newnode or self[fn].cmp(other[fn])))):
                     modified.append(fn)
                 elif listclean:
                     clean.append(fn)
                 del mf1[fn]
-            elif fn not in deletedset:
+            else:
                 added.append(fn)
         removed = mf1.keys()
         if removed:
--- a/tests/test-status-rev.t	Mon Jan 05 16:52:12 2015 -0800
+++ b/tests/test-status-rev.t	Mon Jan 05 17:12:04 2015 -0800
@@ -153,13 +153,10 @@
   R content1_missing_content1-untracked
   R content1_missing_content3-untracked
   R content1_missing_missing-untracked
-BROKEN: content1_content*_missing-tracked appear twice; should just be '!'
   $ hg status -A --rev 0 'glob:*_*_missing-tracked'
   ! content1_content1_missing-tracked
   ! content1_content2_missing-tracked
   ! content1_missing_missing-tracked
   ! missing_content2_missing-tracked
   ! missing_missing_missing-tracked
-  C content1_content1_missing-tracked
-  C content1_content2_missing-tracked
   $ hg status -A --rev 0 'glob:missing_*_missing-untracked'