Mercurial > hg
changeset 48055:84e7a86e3a63
dirstate: simplify the ambiguity clearing at write time
The serialization function is already doing this, so we don't need to do it
manually. We just need to propagate the right definition of "now".
Differential Revision: https://phab.mercurial-scm.org/D11501
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Wed, 22 Sep 2021 14:54:42 +0200 |
parents | f27a83399abb |
children | cd13d3c2ad2e |
files | mercurial/dirstate.py |
diffstat | 1 files changed, 8 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/dirstate.py Tue Sep 28 09:32:24 2021 -0700 +++ b/mercurial/dirstate.py Wed Sep 22 14:54:42 2021 +0200 @@ -836,19 +836,17 @@ # See also the wiki page below for detail: # https://www.mercurial-scm.org/wiki/DirstateTransactionPlan - # emulate dropping timestamp in 'parsers.pack_dirstate' + # record when mtime start to be ambiguous now = _getfsnow(self._opener) - self._map.clearambiguoustimes(self._updatedfiles, now) # emulate that all 'dirstate.normal' results are written out - self._lastnormaltime = 0 self._updatedfiles.clear() # delay writing in-memory changes out tr.addfilegenerator( b'dirstate', (self._filename,), - lambda f: self._writedirstate(tr, f), + lambda f: self._writedirstate(tr, f, now=now), location=b'plain', ) return @@ -867,7 +865,7 @@ """ self._plchangecallbacks[category] = callback - def _writedirstate(self, tr, st): + def _writedirstate(self, tr, st, now=None): # notify callbacks about parents change if self._origpl is not None and self._origpl != self._pl: for c, callback in sorted( @@ -875,9 +873,11 @@ ): callback(self, self._origpl, self._pl) self._origpl = None - # use the modification time of the newly created temporary file as the - # filesystem's notion of 'now' - now = util.fstat(st)[stat.ST_MTIME] & _rangemask + + if now is None: + # use the modification time of the newly created temporary file as the + # filesystem's notion of 'now' + now = util.fstat(st)[stat.ST_MTIME] & _rangemask # enough 'delaywrite' prevents 'pack_dirstate' from dropping # timestamp of each entries in dirstate, because of 'now > mtime'