equal
deleted
inserted
replaced
298 self.keep = keep |
298 self.keep = keep |
299 self.topmost = topmost |
299 self.topmost = topmost |
300 self.replacements = replacements |
300 self.replacements = replacements |
301 self.backupfile = backupfile |
301 self.backupfile = backupfile |
302 |
302 |
303 def write(self): |
303 def write(self, tr=None): |
304 fp = self.repo.vfs('histedit-state', 'w') |
304 if tr: |
|
305 tr.addfilegenerator('histedit-state', ('histedit-state',), |
|
306 self._write, location='plain') |
|
307 else: |
|
308 with self.repo.vfs("histedit-state", "w") as f: |
|
309 self._write(f) |
|
310 |
|
311 def _write(self, fp): |
305 fp.write('v1\n') |
312 fp.write('v1\n') |
306 fp.write('%s\n' % node.hex(self.parentctxnode)) |
313 fp.write('%s\n' % node.hex(self.parentctxnode)) |
307 fp.write('%s\n' % node.hex(self.topmost)) |
314 fp.write('%s\n' % node.hex(self.topmost)) |
308 fp.write('%s\n' % self.keep) |
315 fp.write('%s\n' % self.keep) |
309 fp.write('%d\n' % len(self.actions)) |
316 fp.write('%d\n' % len(self.actions)) |
315 for r in replacement[1]))) |
322 for r in replacement[1]))) |
316 backupfile = self.backupfile |
323 backupfile = self.backupfile |
317 if not backupfile: |
324 if not backupfile: |
318 backupfile = '' |
325 backupfile = '' |
319 fp.write('%s\n' % backupfile) |
326 fp.write('%s\n' % backupfile) |
320 fp.close() |
|
321 |
327 |
322 def _load(self): |
328 def _load(self): |
323 fp = self.repo.vfs('histedit-state', 'r') |
329 fp = self.repo.vfs('histedit-state', 'r') |
324 lines = [l[:-1] for l in fp.readlines()] |
330 lines = [l[:-1] for l in fp.readlines()] |
325 |
331 |