Mercurial > public > mercurial-scm > hg-stable
diff hgext/extdiff.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 | be5a6fe3643a |
children | f0b6fbea00cf |
line wrap: on
line diff
--- a/hgext/extdiff.py Mon Mar 05 15:07:32 2018 -0500 +++ b/hgext/extdiff.py Mon Mar 05 12:30:20 2018 -0500 @@ -65,6 +65,7 @@ import os import re import shutil +import stat import tempfile from mercurial.i18n import _ from mercurial.node import ( @@ -297,7 +298,8 @@ # copyfile() carries over the permission, so the mode check could # be in an 'elif' branch, but for the case where the file has # changed without affecting mtime or size. - if (cpstat.st_mtime != st.st_mtime or cpstat.st_size != st.st_size + if (cpstat[stat.ST_MTIME] != st[stat.ST_MTIME] + or cpstat.st_size != st.st_size or (cpstat.st_mode & 0o100) != (st.st_mode & 0o100)): ui.debug('file changed while diffing. ' 'Overwriting: %s (src: %s)\n' % (working_fn, copy_fn))