Patchwork [04,of,14,FIX-bundle2] applybundle: take source as argument

login
register
mail settings
Submitter Pierre-Yves David
Date Oct. 20, 2015, 2:36 p.m.
Message ID <3949b5bbf0d712f214cf.1445351780@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/11184/
State Accepted
Commit f37de5d44aea401af0b60c3e4bf798cc1c9235c2
Headers show

Comments

Pierre-Yves David - Oct. 20, 2015, 2:36 p.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1445349162 -7200
#      Tue Oct 20 15:52:42 2015 +0200
# Node ID 3949b5bbf0d712f214cf3cbc4c9a11d99799efa1
# Parent  2e2e372d50d71af76fe290a7d745896a65b8f990
# EXP-Topic generaldelta
# Available At http://hg.netv6.net/marmoute-wip/mercurial/
#              hg pull http://hg.netv6.net/marmoute-wip/mercurial/ -r 3949b5bbf0d7
applybundle: take source as argument

We allow to specify the source to carry it to hooks. This get use closer to
'bundle1.apply(...)' and will also use to remove regression in multiple place
were we forget to pass the source to hooks.

Patch

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -300,13 +300,15 @@  def _notransaction():
 
     Raise an exception to highlight the fact that no transaction was expected
     to be created"""
     raise TransactionUnavailable()
 
-def applybundle(repo, unbundler, tr, op=None):
+def applybundle(repo, unbundler, tr, source=None, op=None):
     # transform me in unbundler.apply() as soon as the freeze is lifted
     tr.hookargs['bundle2'] = '1'
+    if source is not None and 'source' not in tr.hookargs:
+        tr.hookargs['source'] = source
     return processbundle(repo, unbundler, lambda: tr, op=op)
 
 def processbundle(repo, unbundler, transactiongetter=None, op=None):
     """This function process a bundle, apply effect to/from a repo