comparison mercurial/bundle2.py @ 37236:9041c91561fc

bunlde2: add 'source' as an optional argument to processbundle() This will help us to pass the source variable to bundleoperation class. Differential Revision: https://phab.mercurial-scm.org/D2994
author Pulkit Goyal <7895pulkit@gmail.com>
date Sat, 31 Mar 2018 14:49:16 +0530
parents 7e906d8a825f
children f7d3915d5b3a
comparison
equal deleted inserted replaced
37235:7e906d8a825f 37236:9041c91561fc
348 tr.hookargs['bundle2'] = '1' 348 tr.hookargs['bundle2'] = '1'
349 if source is not None and 'source' not in tr.hookargs: 349 if source is not None and 'source' not in tr.hookargs:
350 tr.hookargs['source'] = source 350 tr.hookargs['source'] = source
351 if url is not None and 'url' not in tr.hookargs: 351 if url is not None and 'url' not in tr.hookargs:
352 tr.hookargs['url'] = url 352 tr.hookargs['url'] = url
353 return processbundle(repo, unbundler, lambda: tr) 353 return processbundle(repo, unbundler, lambda: tr, source=source)
354 else: 354 else:
355 # the transactiongetter won't be used, but we might as well set it 355 # the transactiongetter won't be used, but we might as well set it
356 op = bundleoperation(repo, lambda: tr) 356 op = bundleoperation(repo, lambda: tr)
357 _processchangegroup(op, unbundler, tr, source, url, **kwargs) 357 _processchangegroup(op, unbundler, tr, source, url, **kwargs)
358 return op 358 return op
423 raise exc 423 raise exc
424 424
425 self.repo.ui.debug('bundle2-input-bundle: %i parts total\n' % 425 self.repo.ui.debug('bundle2-input-bundle: %i parts total\n' %
426 self.count) 426 self.count)
427 427
428 def processbundle(repo, unbundler, transactiongetter=None, op=None): 428 def processbundle(repo, unbundler, transactiongetter=None, op=None, source=''):
429 """This function process a bundle, apply effect to/from a repo 429 """This function process a bundle, apply effect to/from a repo
430 430
431 It iterates over each part then searches for and uses the proper handling 431 It iterates over each part then searches for and uses the proper handling
432 code to process the part. Parts are processed in order. 432 code to process the part. Parts are processed in order.
433 433