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