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

login
register
mail settings
Submitter phabricator
Date July 19, 2021, 10:40 a.m.
Message ID <differential-rev-PHID-DREV-dormuwd2yxz2ulgatpr3-req@mercurial-scm.org>
Download mbox | patch
Permalink /patch/49446/
State Superseded
Headers show

Comments

phabricator - July 19, 2021, 10:40 a.m.
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




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
@@ -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: