Mercurial > public > mercurial-scm > hg-stable
diff tests/svn-safe-append.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 | bdba6a2015d0 |
children | e1e10cbb5568 |
line wrap: on
line diff
--- a/tests/svn-safe-append.py Mon Mar 05 15:07:32 2018 -0500 +++ b/tests/svn-safe-append.py Mon Mar 05 12:30:20 2018 -0500 @@ -6,6 +6,7 @@ Without this svn will not detect workspace changes.""" import os +import stat import sys text = sys.argv[1] @@ -13,16 +14,15 @@ f = open(fname, "ab") try: - before = os.fstat(f.fileno()).st_mtime + before = os.fstat(f.fileno())[stat.ST_MTIME] f.write(text) f.write("\n") finally: f.close() inc = 1 -now = os.stat(fname).st_mtime +now = os.stat(fname)[stat.ST_MTIME] while now == before: t = now + inc inc += 1 os.utime(fname, (t, t)) - now = os.stat(fname).st_mtime - + now = os.stat(fname)[stat.ST_MTIME]