Mercurial > hg
changeset 47690:a685c29ebf54
dirstate: factor out the part retrieve "filedata" out of `normal`
We will need them elsewhere.
Differential Revision: https://phab.mercurial-scm.org/D11132
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 16 Jul 2021 15:07:16 +0200 |
parents | f2aef39abc14 |
children | 33beeb32f73a |
files | mercurial/dirstate.py |
diffstat | 1 files changed, 9 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/dirstate.py Thu Jul 15 02:19:41 2021 +0200 +++ b/mercurial/dirstate.py Fri Jul 16 15:07:16 2021 +0200 @@ -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: