Mercurial > public > mercurial-scm > hg
comparison mercurial/hgweb/common.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 | 6585ac350fd9 |
children | 7066617187c1 |
comparison
equal
deleted
inserted
replaced
36780:f3c314020beb | 36781:ffa3026d4196 |
---|---|
10 | 10 |
11 import base64 | 11 import base64 |
12 import errno | 12 import errno |
13 import mimetypes | 13 import mimetypes |
14 import os | 14 import os |
15 import stat | |
15 | 16 |
16 from .. import ( | 17 from .. import ( |
17 encoding, | 18 encoding, |
18 pycompat, | 19 pycompat, |
19 util, | 20 util, |
130 return os.stat(cl_path) | 131 return os.stat(cl_path) |
131 else: | 132 else: |
132 return os.stat(spath) | 133 return os.stat(spath) |
133 | 134 |
134 def get_mtime(spath): | 135 def get_mtime(spath): |
135 return get_stat(spath, "00changelog.i").st_mtime | 136 return get_stat(spath, "00changelog.i")[stat.ST_MTIME] |
136 | 137 |
137 def ispathsafe(path): | 138 def ispathsafe(path): |
138 """Determine if a path is safe to use for filesystem access.""" | 139 """Determine if a path is safe to use for filesystem access.""" |
139 parts = path.split('/') | 140 parts = path.split('/') |
140 for part in parts: | 141 for part in parts: |