Mercurial > hg
changeset 23283:b04263c38a92
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.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Wed, 05 Nov 2014 13:06:24 +0000 |
parents | 6c1351352b6c |
children | 8d47c212b0dd |
files | mercurial/transaction.py |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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