comparison mercurial/dirstate.py @ 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 ff97e793ed36
children 33beeb32f73a
comparison
equal deleted inserted replaced
47689:f2aef39abc14 47690:a685c29ebf54
634 merged=merged, 634 merged=merged,
635 from_p2=from_p2, 635 from_p2=from_p2,
636 possibly_dirty=possibly_dirty, 636 possibly_dirty=possibly_dirty,
637 ) 637 )
638 638
639 def _get_filedata(self, filename):
640 """returns"""
641 s = os.lstat(self._join(filename))
642 mode = s.st_mode
643 size = s.st_size
644 mtime = s[stat.ST_MTIME]
645 return (mode, size, mtime)
646
639 def normal(self, f, parentfiledata=None): 647 def normal(self, f, parentfiledata=None):
640 """Mark a file normal and clean. 648 """Mark a file normal and clean.
641 649
642 parentfiledata: (mode, size, mtime) of the clean file 650 parentfiledata: (mode, size, mtime) of the clean file
643 651
647 file having been changed by an external process between the 655 file having been changed by an external process between the
648 moment where the file was determined to be clean and now.""" 656 moment where the file was determined to be clean and now."""
649 if parentfiledata: 657 if parentfiledata:
650 (mode, size, mtime) = parentfiledata 658 (mode, size, mtime) = parentfiledata
651 else: 659 else:
652 s = os.lstat(self._join(f)) 660 (mode, size, mtime) = self._get_filedata(f)
653 mode = s.st_mode
654 size = s.st_size
655 mtime = s[stat.ST_MTIME]
656 self._addpath(f, mode=mode, size=size, mtime=mtime) 661 self._addpath(f, mode=mode, size=size, mtime=mtime)
657 self._map.copymap.pop(f, None) 662 self._map.copymap.pop(f, None)
658 if f in self._map.nonnormalset: 663 if f in self._map.nonnormalset:
659 self._map.nonnormalset.remove(f) 664 self._map.nonnormalset.remove(f)
660 if mtime > self._lastnormaltime: 665 if mtime > self._lastnormaltime: