Mercurial > public > mercurial-scm > hg
diff mercurial/commands.py @ 33042:dbc2ee17053e
bundle: transpose transaction scope with bundle type switch
This moves the transaction with-statements outside of the
per-bundle-version switches, so the next patch will be a little
simpler.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 22 Jun 2017 21:27:57 -0700 |
parents | e425f5aabe70 |
children | 18c2489ac96d |
line wrap: on
line diff
--- a/mercurial/commands.py Thu Jun 22 15:03:13 2017 -0700 +++ b/mercurial/commands.py Thu Jun 22 21:27:57 2017 -0700 @@ -5203,14 +5203,15 @@ hint=_('use "hg debugapplystreamclonebundle"')) url = 'bundle:' + fname try: - if isinstance(gen, bundle2.unbundle20): - with repo.transaction('unbundle') as tr: + txnname = 'unbundle' + if not isinstance(gen, bundle2.unbundle20): + txnname = 'unbundle\n%s' % util.hidepassword(url) + with repo.transaction(txnname) as tr: + if isinstance(gen, bundle2.unbundle20): op = bundle2.applybundle(repo, gen, tr, source='unbundle', url=url) - else: - txnname = 'unbundle\n%s' % util.hidepassword(url) - with repo.transaction(txnname) as tr: + else: op = bundle2.applybundle1(repo, gen, tr, source='unbundle', url=url) except error.BundleUnknownFeatureError as exc: