Mercurial > hg
comparison mercurial/dirstate.py @ 47917:1b3c753b62c6
dirstate: drop the `_normal` method
It only has one caller so lets inline it and cleans things up further.
Differential Revision: https://phab.mercurial-scm.org/D11352
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 24 Aug 2021 21:18:28 +0200 |
parents | 65e3d8028f2e |
children | 496a8e383aeb |
comparison
equal
deleted
inserted
replaced
47916:65e3d8028f2e | 47917:1b3c753b62c6 |
---|---|
508 @requires_no_parents_change | 508 @requires_no_parents_change |
509 def set_clean(self, filename, parentfiledata=None): | 509 def set_clean(self, filename, parentfiledata=None): |
510 """record that the current state of the file on disk is known to be clean""" | 510 """record that the current state of the file on disk is known to be clean""" |
511 self._dirty = True | 511 self._dirty = True |
512 self._updatedfiles.add(filename) | 512 self._updatedfiles.add(filename) |
513 self._normal(filename, parentfiledata=parentfiledata) | 513 if parentfiledata: |
514 (mode, size, mtime) = parentfiledata | |
515 else: | |
516 (mode, size, mtime) = self._get_filedata(filename) | |
517 self._addpath(filename, mode=mode, size=size, mtime=mtime) | |
518 self._map.copymap.pop(filename, None) | |
519 if filename in self._map.nonnormalset: | |
520 self._map.nonnormalset.remove(filename) | |
521 if mtime > self._lastnormaltime: | |
522 # Remember the most recent modification timeslot for status(), | |
523 # to make sure we won't miss future size-preserving file content | |
524 # modifications that happen within the same timeslot. | |
525 self._lastnormaltime = mtime | |
514 | 526 |
515 @requires_no_parents_change | 527 @requires_no_parents_change |
516 def set_possibly_dirty(self, filename): | 528 def set_possibly_dirty(self, filename): |
517 """record that the current state of the file on disk is unknown""" | 529 """record that the current state of the file on disk is unknown""" |
518 self._dirty = True | 530 self._dirty = True |
702 s = os.lstat(self._join(filename)) | 714 s = os.lstat(self._join(filename)) |
703 mode = s.st_mode | 715 mode = s.st_mode |
704 size = s.st_size | 716 size = s.st_size |
705 mtime = s[stat.ST_MTIME] | 717 mtime = s[stat.ST_MTIME] |
706 return (mode, size, mtime) | 718 return (mode, size, mtime) |
707 | |
708 def _normal(self, f, parentfiledata=None): | |
709 if parentfiledata: | |
710 (mode, size, mtime) = parentfiledata | |
711 else: | |
712 (mode, size, mtime) = self._get_filedata(f) | |
713 self._addpath(f, mode=mode, size=size, mtime=mtime) | |
714 self._map.copymap.pop(f, None) | |
715 if f in self._map.nonnormalset: | |
716 self._map.nonnormalset.remove(f) | |
717 if mtime > self._lastnormaltime: | |
718 # Remember the most recent modification timeslot for status(), | |
719 # to make sure we won't miss future size-preserving file content | |
720 # modifications that happen within the same timeslot. | |
721 self._lastnormaltime = mtime | |
722 | 719 |
723 def _normallookup(self, f): | 720 def _normallookup(self, f): |
724 '''Mark a file normal, but possibly dirty.''' | 721 '''Mark a file normal, but possibly dirty.''' |
725 if self.in_merge: | 722 if self.in_merge: |
726 # if there is a merge going on and the file was either | 723 # if there is a merge going on and the file was either |