comparison hgext/extdiff.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 be5a6fe3643a
children f0b6fbea00cf
comparison
equal deleted inserted replaced
36780:f3c314020beb 36781:ffa3026d4196
63 from __future__ import absolute_import 63 from __future__ import absolute_import
64 64
65 import os 65 import os
66 import re 66 import re
67 import shutil 67 import shutil
68 import stat
68 import tempfile 69 import tempfile
69 from mercurial.i18n import _ 70 from mercurial.i18n import _
70 from mercurial.node import ( 71 from mercurial.node import (
71 nullid, 72 nullid,
72 short, 73 short,
295 # The only certain way to detect every case is to diff all files, 296 # The only certain way to detect every case is to diff all files,
296 # which could be expensive. 297 # which could be expensive.
297 # copyfile() carries over the permission, so the mode check could 298 # copyfile() carries over the permission, so the mode check could
298 # be in an 'elif' branch, but for the case where the file has 299 # be in an 'elif' branch, but for the case where the file has
299 # changed without affecting mtime or size. 300 # changed without affecting mtime or size.
300 if (cpstat.st_mtime != st.st_mtime or cpstat.st_size != st.st_size 301 if (cpstat[stat.ST_MTIME] != st[stat.ST_MTIME]
302 or cpstat.st_size != st.st_size
301 or (cpstat.st_mode & 0o100) != (st.st_mode & 0o100)): 303 or (cpstat.st_mode & 0o100) != (st.st_mode & 0o100)):
302 ui.debug('file changed while diffing. ' 304 ui.debug('file changed while diffing. '
303 'Overwriting: %s (src: %s)\n' % (working_fn, copy_fn)) 305 'Overwriting: %s (src: %s)\n' % (working_fn, copy_fn))
304 util.copyfile(copy_fn, working_fn) 306 util.copyfile(copy_fn, working_fn)
305 307