diff --git a/mercurial/changelog.py b/mercurial/changelog.py --- a/mercurial/changelog.py +++ b/mercurial/changelog.py @@ -59,11 +59,12 @@ def stripdesc(desc): class appender(object): '''the changelog index must be updated last on disk, so we use this class to delay writes to it''' - def __init__(self, fp, buf): + def __init__(self, vfs, name, mode, buf): self.data = buf + fp = vfs(name, mode) self.fp = fp self.offset = fp.tell() - self.size = util.fstat(fp).st_size + self.size = vfs.fstat(fp).st_size def end(self): return self.size + len("".join(self.data)) @@ -114,7 +115,7 @@ def delayopener(opener, target, divert, if divert: return opener(name + ".a", mode.replace('a', 'w')) # otherwise, divert to memory - return appender(opener(name, mode), buf) + return appender(opener, name, mode, buf) return o class changelog(revlog.revlog): diff --git a/mercurial/scmutil.py b/mercurial/scmutil.py --- a/mercurial/scmutil.py +++ b/mercurial/scmutil.py @@ -245,6 +245,9 @@ class abstractvfs(object): def exists(self, path=None): return os.path.exists(self.join(path)) + def fstat(self, fp): + return util.fstat(fp) + def isdir(self, path=None): return os.path.isdir(self.join(path))