Mercurial > public > mercurial-scm > hg-stable
diff mercurial/dirstate.py @ 36789:ffa3026d4196
cleanup: use stat_result[stat.ST_MTIME] instead of stat_result.st_mtime
The latter is floating point by default, and we've been doing
os.stat_float_times(False). Unfortunately, os.stat_float_times was
removed between Python 3.7.0a1 and 3.7.0b2, so we have to stop using
it.
Differential Revision: https://phab.mercurial-scm.org/D2696
author | Augie Fackler <augie@google.com> |
---|---|
date | Mon, 05 Mar 2018 12:30:20 -0500 |
parents | 0297f9c4caee |
children | d5d42c170f4d |
line wrap: on
line diff
--- a/mercurial/dirstate.py Mon Mar 05 15:07:32 2018 -0500 +++ b/mercurial/dirstate.py Mon Mar 05 12:30:20 2018 -0500 @@ -49,7 +49,7 @@ '''Get "now" timestamp on filesystem''' tmpfd, tmpname = vfs.mkstemp() try: - return os.fstat(tmpfd).st_mtime + return os.fstat(tmpfd)[stat.ST_MTIME] finally: os.close(tmpfd) vfs.unlink(tmpname) @@ -387,7 +387,7 @@ def normal(self, f): '''Mark a file normal and clean.''' s = os.lstat(self._join(f)) - mtime = s.st_mtime + mtime = s[stat.ST_MTIME] self._addpath(f, 'n', s.st_mode, s.st_size & _rangemask, mtime & _rangemask) self._map.copymap.pop(f, None) @@ -626,7 +626,7 @@ self._origpl = None # use the modification time of the newly created temporary file as the # filesystem's notion of 'now' - now = util.fstat(st).st_mtime & _rangemask + 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' @@ -1068,9 +1068,10 @@ or size == -2 # other parent or fn in copymap): madd(fn) - elif time != st.st_mtime and time != st.st_mtime & _rangemask: + elif (time != st[stat.ST_MTIME] + and time != st[stat.ST_MTIME] & _rangemask): ladd(fn) - elif st.st_mtime == lastnormaltime: + elif st[stat.ST_MTIME] == lastnormaltime: # fn may have just been marked as normal and it may have # changed in the same second without changing its size. # This can happen if we quickly do multiple commits.