equal
deleted
inserted
replaced
57 return '\n'.join([l.rstrip() for l in desc.splitlines()]).strip('\n') |
57 return '\n'.join([l.rstrip() for l in desc.splitlines()]).strip('\n') |
58 |
58 |
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)) |
70 def tell(self): |
71 def tell(self): |
71 return self.offset |
72 return self.offset |
112 if name != target: |
113 if name != target: |
113 return opener(name, mode) |
114 return opener(name, mode) |
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): |
121 def __init__(self, opener): |
122 def __init__(self, opener): |
122 revlog.revlog.__init__(self, opener, "00changelog.i") |
123 revlog.revlog.__init__(self, opener, "00changelog.i") |