equal
deleted
inserted
replaced
28 pycompat, |
28 pycompat, |
29 ui as uimod, |
29 ui as uimod, |
30 util, |
30 util, |
31 vfs as vfsmod, |
31 vfs as vfsmod, |
32 ) |
32 ) |
33 |
|
34 if pycompat.ispy3: |
|
35 xrange = range |
|
36 |
33 |
37 |
34 |
38 class fakerepo: |
35 class fakerepo: |
39 def __init__(self): |
36 def __init__(self): |
40 self._filecache = {} |
37 self._filecache = {} |
212 def antiambiguity(): |
209 def antiambiguity(): |
213 filename = 'ambigcheck' |
210 filename = 'ambigcheck' |
214 |
211 |
215 # try some times, because reproduction of ambiguity depends on |
212 # try some times, because reproduction of ambiguity depends on |
216 # "filesystem time" |
213 # "filesystem time" |
217 for i in xrange(5): |
214 for i in range(5): |
218 fp = open(filename, 'w') |
215 fp = open(filename, 'w') |
219 fp.write('FOO') |
216 fp.write('FOO') |
220 fp.close() |
217 fp.close() |
221 |
218 |
222 oldstat = os.stat(filename) |
219 oldstat = os.stat(filename) |
226 |
223 |
227 repetition = 3 |
224 repetition = 3 |
228 |
225 |
229 # repeat changing via checkambigatclosing, to examine whether |
226 # repeat changing via checkambigatclosing, to examine whether |
230 # st_mtime is advanced multiple times as expected |
227 # st_mtime is advanced multiple times as expected |
231 for i in xrange(repetition): |
228 for i in range(repetition): |
232 # explicit closing |
229 # explicit closing |
233 fp = vfsmod.checkambigatclosing(open(filename, 'a')) |
230 fp = vfsmod.checkambigatclosing(open(filename, 'a')) |
234 fp.write('FOO') |
231 fp.write('FOO') |
235 fp.close() |
232 fp.close() |
236 |
233 |