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

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Oct 20 09:36:20 CDT 2015


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at 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.

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
 


More information about the Mercurial-devel mailing list