[PATCH 1 of 2] status: don't list files as both removed and deleted

Martin von Zweigbergk martinvonz at google.com
Tue Jan 6 01:21:41 UTC 2015


# HG changeset patch
# User Martin von Zweigbergk <martinvonz at google.com>
# Date 1420505532 28800
#      Mon Jan 05 16:52:12 2015 -0800
# Node ID 16ccfb957c0659b60b5e1c9d2f1fe8bd3ed97a91
# Parent  d944492445fa0d0b9c164336afab68127080a1f3
status: don't list files as both removed and deleted

When calculating status involving the working copy and a revision
other than the parent of the working copy, the files that are not in
the working context manifest ('mf2' in the basectx._buildstatus())
will be reported as removed (note that deleted files _are_ in the
working context manifest). However, if the file is reported as deleted
in the dirstate, it will get that status too (as shown by failing
tests).

Fix by removing deleted files from the 'removed' list after the main
loop in _buildstatus().

diff --git a/mercurial/context.py b/mercurial/context.py
--- a/mercurial/context.py
+++ b/mercurial/context.py
@@ -156,6 +156,8 @@
             # need to filter files if they are already reported as removed
             unknown = [fn for fn in unknown if fn not in mf1]
             ignored = [fn for fn in ignored if fn not in mf1]
+            # if they're deleted, don't report them as removed
+            removed = [fn for fn in removed if fn not in deletedset]
 
         return scmutil.status(modified, added, removed, deleted, unknown,
                               ignored, clean)
diff --git a/tests/test-revert.t b/tests/test-revert.t
--- a/tests/test-revert.t
+++ b/tests/test-revert.t
@@ -679,7 +679,6 @@
   R content1_content2_missing-untracked
   R content1_missing_content1-untracked
   R content1_missing_content3-untracked
-  R content1_missing_missing-tracked
   R content1_missing_missing-untracked
   ! content1_content1_missing-tracked
   ! content1_content2_missing-tracked
diff --git a/tests/test-status-rev.t b/tests/test-status-rev.t
--- a/tests/test-status-rev.t
+++ b/tests/test-status-rev.t
@@ -153,9 +153,8 @@
   R content1_missing_content1-untracked
   R content1_missing_content3-untracked
   R content1_missing_missing-untracked
-BROKEN: content1_*_missing-tracked appear twice; should just be '!'
+BROKEN: content1_content*_missing-tracked appear twice; should just be '!'
   $ hg status -A --rev 0 'glob:*_*_missing-tracked'
-  R content1_missing_missing-tracked
   ! content1_content1_missing-tracked
   ! content1_content2_missing-tracked
   ! content1_missing_missing-tracked


More information about the Mercurial-devel mailing list