Patchwork D11418: dirstate: remove some usage of `_drop`

login
register
mail settings
Submitter phabricator
Date Sept. 14, 2021, 9:20 p.m.
Message ID <differential-rev-PHID-DREV-hdyenevw5pq6ijufpmc4-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49721/
State Superseded
Headers show

Comments

phabricator - Sept. 14, 2021, 9:20 p.m.
marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  This is a step toward being able to remove the `_drop` method on `dirstate`.

REPOSITORY
  rHG Mercurial

BRANCH
  default

REVISION DETAIL
  https://phab.mercurial-scm.org/D11418

AFFECTED FILES
  mercurial/dirstate.py

CHANGE DETAILS




To: marmoute, #hg-reviewers
Cc: mercurial-patches, mercurial-devel

Patch

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -496,13 +496,13 @@ 
         entry = self._map.get(filename)
         if entry is None:
             return False
-        elif entry.added:
-            self._drop(filename)
-            return True
         else:
             self._dirty = True
             self._updatedfiles.add(filename)
-            self._map.set_untracked(filename)
+            if entry.added:
+                self._map.dropfile(filename)
+            else:
+                self._map.set_untracked(filename)
             return True
 
     @requires_no_parents_change