comparison mercurial/hg.py @ 36781: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 f659a407e5ee
children f0b6fbea00cf
comparison
equal deleted inserted replaced
36780:f3c314020beb 36781:ffa3026d4196
10 10
11 import errno 11 import errno
12 import hashlib 12 import hashlib
13 import os 13 import os
14 import shutil 14 import shutil
15 import stat
15 16
16 from .i18n import _ 17 from .i18n import _
17 from .node import ( 18 from .node import (
18 nullid, 19 nullid,
19 ) 20 )
1111 p = os.path.join(prefix, fname) 1112 p = os.path.join(prefix, fname)
1112 try: 1113 try:
1113 st = os.stat(p) 1114 st = os.stat(p)
1114 except OSError: 1115 except OSError:
1115 st = os.stat(prefix) 1116 st = os.stat(prefix)
1116 state.append((st.st_mtime, st.st_size)) 1117 state.append((st[stat.ST_MTIME], st.st_size))
1117 maxmtime = max(maxmtime, st.st_mtime) 1118 maxmtime = max(maxmtime, st[stat.ST_MTIME])
1118 1119
1119 return tuple(state), maxmtime 1120 return tuple(state), maxmtime
1120 1121
1121 def copy(self): 1122 def copy(self):
1122 """Obtain a copy of this class instance. 1123 """Obtain a copy of this class instance.