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

login
register
mail settings
Submitter Yuya Nishihara
Date Aug. 14, 2017, 7:53 a.m.
Message ID <8af5c6fc8ce4c53b4390.1502697230@mimosa>
Download mbox | patch
Permalink /patch/22969/
State Accepted
Headers show

Comments

Yuya Nishihara - Aug. 14, 2017, 7:53 a.m.
# HG changeset patch
# User Yuya Nishihara <yuya@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.
Augie Fackler - Aug. 15, 2017, 7:53 p.m.
On Mon, Aug 14, 2017 at 04:53:50PM +0900, Yuya Nishihara wrote:
> # HG changeset patch
> # User Yuya Nishihara <yuya@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

queued, thanks

Patch

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