Mercurial > public > mercurial-scm > hg-stable
diff mercurial/bundle2.py @ 33055:18c2489ac96d
bundle: make applybundle() delegate v1 bundles to applybundle1()
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 22 Jun 2017 15:00:19 -0700 |
parents | 2baef42a2881 |
children | 1d2b68952950 |
line wrap: on
line diff
--- a/mercurial/bundle2.py Thu Jun 22 21:27:57 2017 -0700 +++ b/mercurial/bundle2.py Thu Jun 22 15:00:19 2017 -0700 @@ -316,14 +316,17 @@ _processchangegroup(op, cg, tr, source, url, **kwargs) return op -def applybundle(repo, unbundler, tr, source=None, url=None): +def applybundle(repo, unbundler, tr, source=None, url=None, **kwargs): # transform me into unbundler.apply() as soon as the freeze is lifted - tr.hookargs['bundle2'] = '1' - if source is not None and 'source' not in tr.hookargs: - tr.hookargs['source'] = source - if url is not None and 'url' not in tr.hookargs: - tr.hookargs['url'] = url - return processbundle(repo, unbundler, lambda: tr) + if isinstance(unbundler, unbundle20): + tr.hookargs['bundle2'] = '1' + if source is not None and 'source' not in tr.hookargs: + tr.hookargs['source'] = source + if url is not None and 'url' not in tr.hookargs: + tr.hookargs['url'] = url + return processbundle(repo, unbundler, lambda: tr) + else: + return applybundle1(repo, unbundler, tr, source, url, **kwargs) def processbundle(repo, unbundler, transactiongetter=None, op=None): """This function process a bundle, apply effect to/from a repo