Mercurial > public > mercurial-scm > hg
comparison 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 |
comparison
equal
deleted
inserted
replaced
26639:92d67e5729b9 | 26640:b13fdcc4e700 |
---|---|
1240 revs = None | 1240 revs = None |
1241 if 'rev' in opts: | 1241 if 'rev' in opts: |
1242 revs = scmutil.revrange(repo, opts['rev']) | 1242 revs = scmutil.revrange(repo, opts['rev']) |
1243 | 1243 |
1244 bundletype = opts.get('type', 'bzip2').lower() | 1244 bundletype = opts.get('type', 'bzip2').lower() |
1245 cgversion, bcompression = exchange.parsebundlespec(repo, bundletype) | 1245 try: |
1246 bcompression, cgversion = exchange.parsebundlespec( | |
1247 repo, bundletype, strict=False) | |
1248 except error.UnsupportedBundleSpecification as e: | |
1249 raise error.Abort(str(e), | |
1250 hint=_('see "hg help bundle" for supported ' | |
1251 'values for --type')) | |
1246 | 1252 |
1247 if opts.get('all'): | 1253 if opts.get('all'): |
1248 base = ['null'] | 1254 base = ['null'] |
1249 else: | 1255 else: |
1250 base = scmutil.revrange(repo, opts.get('base')) | 1256 base = scmutil.revrange(repo, opts.get('base')) |