Mercurial > public > mercurial-scm > hg
comparison mercurial/bundle2.py @ 26793:f37de5d44aea
applybundle: take source as argument
We allow specifying the source to carry it to hooks. This gets us closer to
'bundle1.apply(...)' and will allow us to remove regressions in multiple places
where we forget to pass the source to hooks.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Tue, 20 Oct 2015 15:52:42 +0200 |
parents | a84e0cacb2dd |
children | dff05b3f47d2 |
comparison
equal
deleted
inserted
replaced
26792:a84e0cacb2dd | 26793:f37de5d44aea |
---|---|
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 | 304 |
305 def applybundle(repo, unbundler, tr, op=None): | 305 def applybundle(repo, unbundler, tr, source=None, op=None): |
306 # transform me into unbundler.apply() as soon as the freeze is lifted | 306 # transform me into unbundler.apply() as soon as the freeze is lifted |
307 tr.hookargs['bundle2'] = '1' | 307 tr.hookargs['bundle2'] = '1' |
308 if source is not None and 'source' not in tr.hookargs: | |
309 tr.hookargs['source'] = source | |
308 return processbundle(repo, unbundler, lambda: tr, op=op) | 310 return processbundle(repo, unbundler, lambda: tr, op=op) |
309 | 311 |
310 def processbundle(repo, unbundler, transactiongetter=None, op=None): | 312 def processbundle(repo, unbundler, transactiongetter=None, op=None): |
311 """This function process a bundle, apply effect to/from a repo | 313 """This function process a bundle, apply effect to/from a repo |
312 | 314 |