Patchwork D208: bundle2: add the capability to store hookargs on bundle operation object

login
register
mail settings
Submitter phabricator
Date Aug. 2, 2017, 12:07 a.m.
Message ID <differential-rev-PHID-DREV-7xv5xfpiuuzzsj5a46uq-req@phab.mercurial-scm.org>
Download mbox | patch
Permalink /patch/22625/
State Superseded
Headers show

Comments

phabricator - Aug. 2, 2017, 12:07 a.m.
pulkit created this revision.
Herald added a subscriber: mercurial-devel.
Herald added a reviewer: hg-reviewers.

REVISION SUMMARY
  There are extensions like pushrebase, pushvars which run hooks on a server
  before taking the lock. Since the lock is not taken, transaction is not there,
  so the hookargs can't be stored on the transaction. Adding hooksargs to bundle
  operation object will help in running hooks before taking the lock.
  
  This is a part of moving fb's extension bundle2hooks to core.

REPOSITORY
  rHG Mercurial

REVISION DETAIL
  https://phab.mercurial-scm.org/D208

AFFECTED FILES
  mercurial/bundle2.py

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -299,6 +299,10 @@ 
         self.gettransaction = transactiongetter
         self.reply = None
         self.captureoutput = captureoutput
+        self.hookargs = {}
+
+    def addhookargs(self, hookargs):
+        self.hookargs.update(hookargs)
 
 class TransactionUnavailable(RuntimeError):
     pass