##// END OF EJS Templates
dirstate: simplify the ambiguity clearing at write time...
marmoute -
r48869:84e7a86e default
parent child Browse files
Show More
@@ -836,19 +836,17 b' class dirstate(object):'
836 836 # See also the wiki page below for detail:
837 837 # https://www.mercurial-scm.org/wiki/DirstateTransactionPlan
838 838
839 # emulate dropping timestamp in 'parsers.pack_dirstate'
839 # record when mtime start to be ambiguous
840 840 now = _getfsnow(self._opener)
841 self._map.clearambiguoustimes(self._updatedfiles, now)
842 841
843 842 # emulate that all 'dirstate.normal' results are written out
844 self._lastnormaltime = 0
845 843 self._updatedfiles.clear()
846 844
847 845 # delay writing in-memory changes out
848 846 tr.addfilegenerator(
849 847 b'dirstate',
850 848 (self._filename,),
851 lambda f: self._writedirstate(tr, f),
849 lambda f: self._writedirstate(tr, f, now=now),
852 850 location=b'plain',
853 851 )
854 852 return
@@ -867,7 +865,7 b' class dirstate(object):'
867 865 """
868 866 self._plchangecallbacks[category] = callback
869 867
870 def _writedirstate(self, tr, st):
868 def _writedirstate(self, tr, st, now=None):
871 869 # notify callbacks about parents change
872 870 if self._origpl is not None and self._origpl != self._pl:
873 871 for c, callback in sorted(
@@ -875,9 +873,11 b' class dirstate(object):'
875 873 ):
876 874 callback(self, self._origpl, self._pl)
877 875 self._origpl = None
878 # use the modification time of the newly created temporary file as the
879 # filesystem's notion of 'now'
880 now = util.fstat(st)[stat.ST_MTIME] & _rangemask
876
877 if now is None:
878 # use the modification time of the newly created temporary file as the
879 # filesystem's notion of 'now'
880 now = util.fstat(st)[stat.ST_MTIME] & _rangemask
881 881
882 882 # enough 'delaywrite' prevents 'pack_dirstate' from dropping
883 883 # timestamp of each entries in dirstate, because of 'now > mtime'
General Comments 0
You need to be logged in to leave comments. Login now