Show More
@@ -13,6 +13,7 b' from mercurial import (' | |||
|
13 | 13 | scmutil, |
|
14 | 14 | ui as uimod, |
|
15 | 15 | util, |
|
16 | vfs as vfsmod, | |
|
16 | 17 | ) |
|
17 | 18 | |
|
18 | 19 | filecache = scmutil.filecache |
@@ -73,7 +74,7 b' def basic(repo):' | |||
|
73 | 74 | # atomic replace file, size doesn't change |
|
74 | 75 | # hopefully st_mtime doesn't change as well so this doesn't use the cache |
|
75 | 76 | # because of inode change |
|
76 |
f = |
|
|
77 | f = vfsmod.vfs('.')('x', 'w', atomictemp=True) | |
|
77 | 78 | f.write('b') |
|
78 | 79 | f.close() |
|
79 | 80 | |
@@ -97,7 +98,7 b' def basic(repo):' | |||
|
97 | 98 | # should recreate the object |
|
98 | 99 | repo.cached |
|
99 | 100 | |
|
100 |
f = |
|
|
101 | f = vfsmod.vfs('.')('y', 'w', atomictemp=True) | |
|
101 | 102 | f.write('B') |
|
102 | 103 | f.close() |
|
103 | 104 | |
@@ -105,10 +106,10 b' def basic(repo):' | |||
|
105 | 106 | print("* file y changed inode") |
|
106 | 107 | repo.cached |
|
107 | 108 | |
|
108 |
f = |
|
|
109 | f = vfsmod.vfs('.')('x', 'w', atomictemp=True) | |
|
109 | 110 | f.write('c') |
|
110 | 111 | f.close() |
|
111 |
f = |
|
|
112 | f = vfsmod.vfs('.')('y', 'w', atomictemp=True) | |
|
112 | 113 | f.write('C') |
|
113 | 114 | f.close() |
|
114 | 115 | |
@@ -200,12 +201,12 b' def antiambiguity():' | |||
|
200 | 201 | # st_mtime is advanced multiple times as expected |
|
201 | 202 | for i in xrange(repetition): |
|
202 | 203 | # explicit closing |
|
203 |
fp = |
|
|
204 | fp = vfsmod.checkambigatclosing(open(filename, 'a')) | |
|
204 | 205 | fp.write('FOO') |
|
205 | 206 | fp.close() |
|
206 | 207 | |
|
207 | 208 | # implicit closing by "with" statement |
|
208 |
with |
|
|
209 | with vfsmod.checkambigatclosing(open(filename, 'a')) as fp: | |
|
209 | 210 | fp.write('BAR') |
|
210 | 211 | |
|
211 | 212 | newstat = os.stat(filename) |
General Comments 0
You need to be logged in to leave comments.
Login now