[PATCH 01 of 14 FIX-bundle2] bundle2: introduce an "applybundle" function

Pierre-Yves David pierre-yves.david at ens-lyon.org
Tue Oct 20 14:36:17 UTC 2015


# HG changeset patch
# User Pierre-Yves David <pierre-yves.david at fb.com>
# Date 1445348739 -7200
#      Tue Oct 20 15:45:39 2015 +0200
# Node ID 93a27c3e16d0ec1904a50757a5503ca97174aac0
# Parent  df1a29ec45bfaee30f974b06a0214a3359b369aa
# EXP-Topic generaldelta
# Available At http://hg.netv6.net/marmoute-wip/mercurial/
#              hg pull http://hg.netv6.net/marmoute-wip/mercurial/ -r 93a27c3e16d0
bundle2: introduce an "applybundle" function

there is case were the intend is clear and the transaction is not optional. We
want to be able to alter that transaction in a wide and easy way. We cannot get
a unified '.apply(repo)' method for bundle1 and bundle2 yet because the api are
still a bit too far apart. But this is a good step forward to get the rc out.

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -300,10 +300,14 @@ 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):
+    # transform me in unbundler.apply() as soon as the freeze is lifted
+    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
 
     It iterates over each part then searches for and uses the proper handling
     code to process the part. Parts are processed in order.


More information about the Mercurial-devel mailing list