# HG changeset patch # User Pierre-Yves David # Date 1397768055 14400 # Node ID c0d96bceadc2c41adff321224678b58b48356399 # Parent 468cd774aa22c330b891300c6dbbcab177924517 bundle2: allow extensions to plug into the push process Extensions are offered functions to add parts and process their results. diff -r 468cd774aa22 -r c0d96bceadc2 mercurial/exchange.py --- a/mercurial/exchange.py Thu Apr 17 16:04:58 2014 -0400 +++ b/mercurial/exchange.py Thu Apr 17 16:54:15 2014 -0400 @@ -219,6 +219,7 @@ part = bundle2.bundlepart('B2X:CHECK:HEADS', data=iter(pushop.remoteheads)) bundler.addpart(part) + extrainfo = _pushbundle2extraparts(pushop, bundler) # add the changegroup bundle cg = changegroup.getlocalbundle(pushop.repo, 'push', pushop.outgoing) cgpart = bundle2.bundlepart('B2X:CHANGEGROUP', data=cg.getchunks()) @@ -232,6 +233,21 @@ cgreplies = op.records.getreplies(cgpart.id) assert len(cgreplies['changegroup']) == 1 pushop.ret = cgreplies['changegroup'][0]['return'] + _pushbundle2extrareply(pushop, op, extrainfo) + +def _pushbundle2extraparts(pushop, bundler): + """hook function to let extensions add parts + + Return a dict to let extensions pass data to the reply processing. + """ + return {} + +def _pushbundle2extrareply(pushop, op, extrainfo): + """hook function to let extensions react to part replies + + The dict from _pushbundle2extrareply is fed to this function. + """ + pass def _pushchangeset(pushop): """Make the actual push of changeset bundle to remote repo"""