Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/commands.py @ 32946:ac9867519103
unbundle: create transaction for bundle1 unbundling earlier
See earlier patch for motivation.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Thu, 15 Jun 2017 22:18:21 -0700 |
parents | 0d98b11b8467 |
children | af31d531dda0 |
comparison
equal
deleted
inserted
replaced
32945:febd6bfa770d | 32946:ac9867519103 |
---|---|
5319 if isinstance(gen, streamclone.streamcloneapplier): | 5319 if isinstance(gen, streamclone.streamcloneapplier): |
5320 raise error.Abort( | 5320 raise error.Abort( |
5321 _('packed bundles cannot be applied with ' | 5321 _('packed bundles cannot be applied with ' |
5322 '"hg unbundle"'), | 5322 '"hg unbundle"'), |
5323 hint=_('use "hg debugapplystreamclonebundle"')) | 5323 hint=_('use "hg debugapplystreamclonebundle"')) |
5324 url = 'bundle:' + fname | |
5324 if isinstance(gen, bundle2.unbundle20): | 5325 if isinstance(gen, bundle2.unbundle20): |
5325 with repo.transaction('unbundle') as tr: | 5326 with repo.transaction('unbundle') as tr: |
5326 try: | 5327 try: |
5327 op = bundle2.applybundle(repo, gen, tr, | 5328 op = bundle2.applybundle(repo, gen, tr, |
5328 source='unbundle', | 5329 source='unbundle', |
5329 url='bundle:' + fname) | 5330 url=url) |
5330 except error.BundleUnknownFeatureError as exc: | 5331 except error.BundleUnknownFeatureError as exc: |
5331 raise error.Abort( | 5332 raise error.Abort( |
5332 _('%s: unknown bundle feature, %s') % (fname, exc), | 5333 _('%s: unknown bundle feature, %s') % (fname, exc), |
5333 hint=_("see https://mercurial-scm.org/" | 5334 hint=_("see https://mercurial-scm.org/" |
5334 "wiki/BundleFeature for more " | 5335 "wiki/BundleFeature for more " |
5335 "information")) | 5336 "information")) |
5336 changes = [r.get('return', 0) | 5337 changes = [r.get('return', 0) |
5337 for r in op.records['changegroup']] | 5338 for r in op.records['changegroup']] |
5338 modheads = changegroup.combineresults(changes) | 5339 modheads = changegroup.combineresults(changes) |
5339 else: | 5340 else: |
5340 modheads = gen.apply(repo, 'unbundle', 'bundle:' + fname) | 5341 txnname = 'unbundle\n%s' % util.hidepassword(url) |
5342 with repo.transaction(txnname): | |
5343 modheads = gen.apply(repo, 'unbundle', url) | |
5341 | 5344 |
5342 return postincoming(ui, repo, modheads, opts.get(r'update'), None, None) | 5345 return postincoming(ui, repo, modheads, opts.get(r'update'), None, None) |
5343 | 5346 |
5344 @command('^update|up|checkout|co', | 5347 @command('^update|up|checkout|co', |
5345 [('C', 'clean', None, _('discard uncommitted changes (no backup)')), | 5348 [('C', 'clean', None, _('discard uncommitted changes (no backup)')), |