changeset 26790:28a6c2d72097

bundle2: introduce an "applybundle" function There is a case where the intent 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.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Tue, 20 Oct 2015 15:45:39 +0200
parents e6003ecf3257
children 13b861d1cce9
files mercurial/bundle2.py
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/bundle2.py	Thu Oct 15 01:31:04 2015 -0700
+++ b/mercurial/bundle2.py	Tue Oct 20 15:45:39 2015 +0200
@@ -302,6 +302,10 @@
     to be created"""
     raise TransactionUnavailable()
 
+def applybundle(repo, unbundler, tr, op=None):
+    # transform me into 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