##// END OF EJS Templates
histedit: add transaction support to writing the state file...
Durham Goode -
r31511:fa8aaff2 default
parent child Browse files
Show More
@@ -300,8 +300,15 b' class histeditstate(object):'
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))
@@ -317,7 +324,6 b' class histeditstate(object):'
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')
General Comments 0
You need to be logged in to leave comments. Login now