comparison mercurial/commands.py @ 33041:e425f5aabe70

unbundle: move BundleUnknownFeatureError exception handling out This just moves the BundleUnknownFeatureError exception handling one level up so we collect the bundle2.applybundle{,1}() calls together. applybundle1() will never throw the exception, so it should have no functional consequence.
author Martin von Zweigbergk <martinvonz@google.com>
date Thu, 22 Jun 2017 15:03:13 -0700
parents 2baef42a2881
children dbc2ee17053e
comparison
equal deleted inserted replaced
33040:2baef42a2881 33041:e425f5aabe70
5200 raise error.Abort( 5200 raise error.Abort(
5201 _('packed bundles cannot be applied with ' 5201 _('packed bundles cannot be applied with '
5202 '"hg unbundle"'), 5202 '"hg unbundle"'),
5203 hint=_('use "hg debugapplystreamclonebundle"')) 5203 hint=_('use "hg debugapplystreamclonebundle"'))
5204 url = 'bundle:' + fname 5204 url = 'bundle:' + fname
5205 if isinstance(gen, bundle2.unbundle20): 5205 try:
5206 with repo.transaction('unbundle') as tr: 5206 if isinstance(gen, bundle2.unbundle20):
5207 try: 5207 with repo.transaction('unbundle') as tr:
5208 op = bundle2.applybundle(repo, gen, tr, 5208 op = bundle2.applybundle(repo, gen, tr,
5209 source='unbundle', 5209 source='unbundle',
5210 url=url) 5210 url=url)
5211 except error.BundleUnknownFeatureError as exc: 5211 else:
5212 raise error.Abort( 5212 txnname = 'unbundle\n%s' % util.hidepassword(url)
5213 _('%s: unknown bundle feature, %s') % (fname, exc), 5213 with repo.transaction(txnname) as tr:
5214 hint=_("see https://mercurial-scm.org/" 5214 op = bundle2.applybundle1(repo, gen, tr,
5215 "wiki/BundleFeature for more " 5215 source='unbundle', url=url)
5216 "information")) 5216 except error.BundleUnknownFeatureError as exc:
5217 else: 5217 raise error.Abort(
5218 txnname = 'unbundle\n%s' % util.hidepassword(url) 5218 _('%s: unknown bundle feature, %s') % (fname, exc),
5219 with repo.transaction(txnname) as tr: 5219 hint=_("see https://mercurial-scm.org/"
5220 op = bundle2.applybundle1(repo, gen, tr, source='unbundle', 5220 "wiki/BundleFeature for more "
5221 url=url) 5221 "information"))
5222 modheads = bundle2.combinechangegroupresults(op) 5222 modheads = bundle2.combinechangegroupresults(op)
5223 5223
5224 return postincoming(ui, repo, modheads, opts.get(r'update'), None, None) 5224 return postincoming(ui, repo, modheads, opts.get(r'update'), None, None)
5225 5225
5226 @command('^update|up|checkout|co', 5226 @command('^update|up|checkout|co',