# HG changeset patch # User Pierre-Yves David # Date 1623193184 -7200 # Node ID 88439c6fbafc77321c71c5a92c4642d422ffb471 # Parent d2e0226b511a0ae37a4b315793f4ee3412e02cba transaction: simplify `undo.backupfiles` file creation with a variable This make the code shorter and clearer. (This is an opportunity improvement while looking at something next to that.) Differential Revision: https://phab.mercurial-scm.org/D10846 diff -r d2e0226b511a -r 88439c6fbafc mercurial/transaction.py --- a/mercurial/transaction.py Wed Jun 09 00:59:04 2021 +0200 +++ b/mercurial/transaction.py Wed Jun 09 00:59:44 2021 +0200 @@ -633,9 +633,9 @@ """write transaction data for possible future undo call""" if self._undoname is None: return - undobackupfile = self._opener.open( - b"%s.backupfiles" % self._undoname, b'w' - ) + + undo_backup_path = b"%s.backupfiles" % self._undoname + undobackupfile = self._opener.open(undo_backup_path, b'w') undobackupfile.write(b'%d\n' % version) for l, f, b, c in self._backupentries: if not f: # temporary file