D11132: dirstate: factor out the part retrieve "filedata" out of `normal`

marmoute (Pierre-Yves David) phabricator at mercurial-scm.org
Mon Jul 19 10:40:53 UTC 2021


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

REVISION SUMMARY
  We will need them elsewhere.

REPOSITORY
  rHG Mercurial

BRANCH
  default

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

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
@@ -636,6 +636,14 @@
             possibly_dirty=possibly_dirty,
         )
 
+    def _get_filedata(self, filename):
+        """returns"""
+        s = os.lstat(self._join(filename))
+        mode = s.st_mode
+        size = s.st_size
+        mtime = s[stat.ST_MTIME]
+        return (mode, size, mtime)
+
     def normal(self, f, parentfiledata=None):
         """Mark a file normal and clean.
 
@@ -649,10 +657,7 @@
         if parentfiledata:
             (mode, size, mtime) = parentfiledata
         else:
-            s = os.lstat(self._join(f))
-            mode = s.st_mode
-            size = s.st_size
-            mtime = s[stat.ST_MTIME]
+            (mode, size, mtime) = self._get_filedata(f)
         self._addpath(f, mode=mode, size=size, mtime=mtime)
         self._map.copymap.pop(f, None)
         if f in self._map.nonnormalset:



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


More information about the Mercurial-devel mailing list