[PATCH 2 of 2] bundle2: relax the condition to update transaction.hookargs

Yuya Nishihara yuya at tcha.org
Mon Aug 14 03:53:50 EDT 2017


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1502590235 -32400
#      Sun Aug 13 11:10:35 2017 +0900
# Node ID 8af5c6fc8ce4c53b43900c6bfb565daa285b8af1
# Parent  1643bad8116707fb6e162a509682b470e9223fba
bundle2: relax the condition to update transaction.hookargs

This is just a micro optimization. If hookargs is empty, nothing should be
necessary.

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -304,15 +304,15 @@ class bundleoperation(object):
     def gettransaction(self):
         transaction = self._gettransaction()
 
-        if self.hookargs is not None:
+        if self.hookargs:
             # the ones added to the transaction supercede those added
             # to the operation.
             self.hookargs.update(transaction.hookargs)
             transaction.hookargs = self.hookargs
 
-            # mark the hookargs as flushed.  further attempts to add to
-            # hookargs will result in an abort.
-            self.hookargs = None
+        # mark the hookargs as flushed.  further attempts to add to
+        # hookargs will result in an abort.
+        self.hookargs = None
 
         return transaction
 


More information about the Mercurial-devel mailing list