transaction: extract backupentry registration in a dedicated function
We are about to use the 'backupentry' mechanism to allow cleaning up
transaction-related temporary files (such as 'changelog.i.a'). We start
by extracting the entry registration into its own method for easy reuse.
At that point, I would like to rename the backup-file related variable to
something generic but I'm a bit short of ideas.
--- a/mercurial/transaction.py Sat Nov 08 16:35:15 2014 +0000
+++ b/mercurial/transaction.py Wed Nov 05 13:06:24 2014 +0000
@@ -190,9 +190,13 @@
else:
backupfile = ''
- self._backupentries.append((file, backupfile))
+ self._addbackupentry((file, backupfile))
+
+ def _addbackupentry(self, entry):
+ """register a new backup entry and write it to disk"""
+ self._backupentries.append(entry)
self._backupmap[file] = len(self._backupentries) - 1
- self._backupsfile.write("%s\0%s\n" % (file, backupfile))
+ self._backupsfile.write("%s\0%s\n" % entry)
self._backupsfile.flush()
@active