Mercurial > public > mercurial-scm > hg
diff mercurial/commands.py @ 26640:b13fdcc4e700
exchange: refactor bundle specification parsing
The old code was tailored to `hg bundle` usage and not appropriate for
use as a general API, which clone bundles will require. The code has
been rewritten to make it more generally suitable.
We introduce dedicated error types to represent invalid and unsupported
bundle specifications. The reason we need dedicated error types (rather
than error.Abort) is because clone bundles will want to catch these
exception as part of filtering entries. We don't want to swallow
error.Abort on principle.
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Tue, 13 Oct 2015 10:57:54 -0700 |
parents | 92d67e5729b9 |
children | 5c57d01fe64e |
line wrap: on
line diff
--- a/mercurial/commands.py Tue Oct 13 11:43:21 2015 -0700 +++ b/mercurial/commands.py Tue Oct 13 10:57:54 2015 -0700 @@ -1242,7 +1242,13 @@ revs = scmutil.revrange(repo, opts['rev']) bundletype = opts.get('type', 'bzip2').lower() - cgversion, bcompression = exchange.parsebundlespec(repo, bundletype) + try: + bcompression, cgversion = exchange.parsebundlespec( + repo, bundletype, strict=False) + except error.UnsupportedBundleSpecification as e: + raise error.Abort(str(e), + hint=_('see "hg help bundle" for supported ' + 'values for --type')) if opts.get('all'): base = ['null']