D10929: dirstate: move the _rangemask filtering closer to its storage

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Fri Jul 2 15:18:10 UTC 2021


marmoute created this revision.
Herald added a reviewer: hg-reviewers.
Herald added a subscriber: mercurial-patches.

REVISION SUMMARY
  The goal is to get ready to move these kind of processing at a lower level. We start with move
  move _rangemask filtering close to where it is sent to the lower level to make the future move trivial.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

AFFECTED FILES
  mercurial/dirstate.py

CHANGE DETAILS

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -455,6 +455,10 @@
                     msg = _(b'file %r in dirstate clashes with %r')
                     msg %= (pycompat.bytestr(d), pycompat.bytestr(f))
                     raise error.Abort(msg)
+        if size != NONNORMAL and size != FROM_P2:
+            size = size & _rangemask
+        if mtime != AMBIGUOUS_TIME:
+            mtime = mtime & _rangemask
         self._dirty = True
         self._updatedfiles.add(f)
         self._map.addfile(f, oldstate, state, mode, size, mtime)
@@ -476,7 +480,7 @@
             mode = s.st_mode
             size = s.st_size
             mtime = s[stat.ST_MTIME]
-        self._addpath(f, b'n', mode, size & _rangemask, mtime & _rangemask)
+        self._addpath(f, b'n', mode, size, mtime)
         self._map.copymap.pop(f, None)
         if f in self._map.nonnormalset:
             self._map.nonnormalset.remove(f)



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


More information about the Mercurial-devel mailing list