Mercurial > public > mercurial-scm > hg
comparison mercurial/bundle2.py @ 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 | c94cdeeb586a |
children | a84e0cacb2dd |
comparison
equal
deleted
inserted
replaced
26789:e6003ecf3257 | 26790:28a6c2d72097 |
---|---|
299 """default method to get a transaction while processing a bundle | 299 """default method to get a transaction while processing a bundle |
300 | 300 |
301 Raise an exception to highlight the fact that no transaction was expected | 301 Raise an exception to highlight the fact that no transaction was expected |
302 to be created""" | 302 to be created""" |
303 raise TransactionUnavailable() | 303 raise TransactionUnavailable() |
304 | |
305 def applybundle(repo, unbundler, tr, op=None): | |
306 # transform me into unbundler.apply() as soon as the freeze is lifted | |
307 return processbundle(repo, unbundler, lambda: tr, op=op) | |
304 | 308 |
305 def processbundle(repo, unbundler, transactiongetter=None, op=None): | 309 def processbundle(repo, unbundler, transactiongetter=None, op=None): |
306 """This function process a bundle, apply effect to/from a repo | 310 """This function process a bundle, apply effect to/from a repo |
307 | 311 |
308 It iterates over each part then searches for and uses the proper handling | 312 It iterates over each part then searches for and uses the proper handling |