##// END OF EJS Templates
changelog: use "vfs.fstat()" instead of "util.fstat()"...
FUJIWARA Katsunori -
r19899:8c3dcbbf default
parent child Browse files
Show More
@@ -59,11 +59,12 b' def stripdesc(desc):'
59 class appender(object):
59 class appender(object):
60 '''the changelog index must be updated last on disk, so we use this class
60 '''the changelog index must be updated last on disk, so we use this class
61 to delay writes to it'''
61 to delay writes to it'''
62 def __init__(self, fp, buf):
62 def __init__(self, vfs, name, mode, buf):
63 self.data = buf
63 self.data = buf
64 fp = vfs(name, mode)
64 self.fp = fp
65 self.fp = fp
65 self.offset = fp.tell()
66 self.offset = fp.tell()
66 self.size = util.fstat(fp).st_size
67 self.size = vfs.fstat(fp).st_size
67
68
68 def end(self):
69 def end(self):
69 return self.size + len("".join(self.data))
70 return self.size + len("".join(self.data))
@@ -114,7 +115,7 b' def delayopener(opener, target, divert, '
114 if divert:
115 if divert:
115 return opener(name + ".a", mode.replace('a', 'w'))
116 return opener(name + ".a", mode.replace('a', 'w'))
116 # otherwise, divert to memory
117 # otherwise, divert to memory
117 return appender(opener(name, mode), buf)
118 return appender(opener, name, mode, buf)
118 return o
119 return o
119
120
120 class changelog(revlog.revlog):
121 class changelog(revlog.revlog):
@@ -245,6 +245,9 b' class abstractvfs(object):'
245 def exists(self, path=None):
245 def exists(self, path=None):
246 return os.path.exists(self.join(path))
246 return os.path.exists(self.join(path))
247
247
248 def fstat(self, fp):
249 return util.fstat(fp)
250
248 def isdir(self, path=None):
251 def isdir(self, path=None):
249 return os.path.isdir(self.join(path))
252 return os.path.isdir(self.join(path))
250
253
General Comments 0
You need to be logged in to leave comments. Login now