dirstate: move the _rangemask filtering closer to its storage
authorPierre-Yves David <pierre-yves.david@octobus.net>
Fri, 02 Jul 2021 01:02:46 +0200
changeset 47485 5eb65ec12465
parent 47484 3f13dfa1fa78
child 47486 523c00383e79
dirstate: move the _rangemask filtering closer to its storage 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. Differential Revision: https://phab.mercurial-scm.org/D10929
mercurial/dirstate.py
--- a/mercurial/dirstate.py	Thu Jul 01 19:15:30 2021 +0200
+++ b/mercurial/dirstate.py	Fri Jul 02 01:02:46 2021 +0200
@@ -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)