[Updated] D11428: dirstate: inline the last two `_drop` usage

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Mon Sep 20 14:07:47 UTC 2021


Closed by commit rHGd459c6b84961: dirstate: inline the last two `_drop` usage (authored by marmoute).
This revision was automatically updated to reflect the committed changes.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D11428?vs=30266&id=30310

CHANGES SINCE LAST ACTION
  https://phab.mercurial-scm.org/D11428/new/

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

AFFECTED FILES
  hgext/largefiles/lfcommands.py
  mercurial/dirstate.py
  tests/test-rebuildstate.t

CHANGE DETAILS

diff --git a/tests/test-rebuildstate.t b/tests/test-rebuildstate.t
--- a/tests/test-rebuildstate.t
+++ b/tests/test-rebuildstate.t
@@ -19,7 +19,8 @@
   >       if opts.get('normal_lookup'):
   >         repo.dirstate._normallookup(file)
   >       else:
-  >         repo.dirstate._drop(file)
+  >         repo.dirstate._map.dropfile(file)
+  >         repo.dirstate._dirty = True
   > 
   >     repo.dirstate.write(repo.currenttransaction())
   >   finally:
diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -560,7 +560,9 @@
             possibly_dirty = True
         elif not (p1_tracked or wc_tracked):
             # the file is no longer relevant to anyone
-            self._drop(filename)
+            if self._map.dropfile(filename):
+                self._dirty = True
+                self._updatedfiles.add(filename)
         elif (not p1_tracked) and wc_tracked:
             if entry is not None and entry.added:
                 return  # avoid dropping copy information (maybe?)
@@ -742,12 +744,6 @@
         self._addpath(f, possibly_dirty=True)
         self._map.copymap.pop(f, None)
 
-    def _drop(self, filename):
-        """internal function to drop a file from the dirstate"""
-        if self._map.dropfile(filename):
-            self._dirty = True
-            self._updatedfiles.add(filename)
-
     def _discoverpath(self, path, normed, ignoremissing, exists, storemap):
         if exists is None:
             exists = os.path.lexists(os.path.join(self._root, path))
@@ -860,7 +856,8 @@
         for f in to_lookup:
             self._normallookup(f)
         for f in to_drop:
-            self._drop(f)
+            if self._map.dropfile(f):
+                self._updatedfiles.add(f)
 
         self._dirty = True
 
diff --git a/hgext/largefiles/lfcommands.py b/hgext/largefiles/lfcommands.py
--- a/hgext/largefiles/lfcommands.py
+++ b/hgext/largefiles/lfcommands.py
@@ -577,7 +577,7 @@
                 repo.wvfs.unlinkpath(lfutil.standin(f))
                 # This needs to happen for dropped files, otherwise they stay in
                 # the M state.
-                lfdirstate._drop(f)
+                lfdirstate._map.dropfile(f)
 
             statuswriter(_(b'getting changed largefiles\n'))
             cachelfiles(ui, repo, None, lfiles)



To: marmoute, #hg-reviewers, Alphare
Cc: Alphare, mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20210920/70524650/attachment-0002.html>


More information about the Mercurial-patches mailing list