308 |
308 |
309 Raise an exception to highlight the fact that no transaction was expected |
309 Raise an exception to highlight the fact that no transaction was expected |
310 to be created""" |
310 to be created""" |
311 raise TransactionUnavailable() |
311 raise TransactionUnavailable() |
312 |
312 |
313 def applybundle1(repo, cg, tr, source, url, **kwargs): |
|
314 # the transactiongetter won't be used, but we might as well set it |
|
315 op = bundleoperation(repo, lambda: tr) |
|
316 _processchangegroup(op, cg, tr, source, url, **kwargs) |
|
317 return op |
|
318 |
|
319 def applybundle(repo, unbundler, tr, source=None, url=None, **kwargs): |
313 def applybundle(repo, unbundler, tr, source=None, url=None, **kwargs): |
320 # transform me into unbundler.apply() as soon as the freeze is lifted |
314 # transform me into unbundler.apply() as soon as the freeze is lifted |
321 if isinstance(unbundler, unbundle20): |
315 if isinstance(unbundler, unbundle20): |
322 tr.hookargs['bundle2'] = '1' |
316 tr.hookargs['bundle2'] = '1' |
323 if source is not None and 'source' not in tr.hookargs: |
317 if source is not None and 'source' not in tr.hookargs: |
324 tr.hookargs['source'] = source |
318 tr.hookargs['source'] = source |
325 if url is not None and 'url' not in tr.hookargs: |
319 if url is not None and 'url' not in tr.hookargs: |
326 tr.hookargs['url'] = url |
320 tr.hookargs['url'] = url |
327 return processbundle(repo, unbundler, lambda: tr) |
321 return processbundle(repo, unbundler, lambda: tr) |
328 else: |
322 else: |
329 return applybundle1(repo, unbundler, tr, source, url, **kwargs) |
323 # the transactiongetter won't be used, but we might as well set it |
|
324 op = bundleoperation(repo, lambda: tr) |
|
325 _processchangegroup(op, unbundler, tr, source, url, **kwargs) |
|
326 return op |
330 |
327 |
331 def processbundle(repo, unbundler, transactiongetter=None, op=None): |
328 def processbundle(repo, unbundler, transactiongetter=None, op=None): |
332 """This function process a bundle, apply effect to/from a repo |
329 """This function process a bundle, apply effect to/from a repo |
333 |
330 |
334 It iterates over each part then searches for and uses the proper handling |
331 It iterates over each part then searches for and uses the proper handling |