Mercurial > public > mercurial-scm > hg
comparison mercurial/commands.py @ 26510:77c13f3c01ca
bundle: extract the parsing of the bundle type in a function
We are going to introduce significant extensions of the bundle parsing code to
support creation of bundle2 through the bundle command. As an early step, we
extract the logic in its own function.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Thu, 01 Oct 2015 18:01:24 -0700 |
parents | 0748083f2898 |
children | 15ce78517d4b |
comparison
equal
deleted
inserted
replaced
26509:83d82fbefccb | 26510:77c13f3c01ca |
---|---|
1236 revs = None | 1236 revs = None |
1237 if 'rev' in opts: | 1237 if 'rev' in opts: |
1238 revs = scmutil.revrange(repo, opts['rev']) | 1238 revs = scmutil.revrange(repo, opts['rev']) |
1239 | 1239 |
1240 bundletype = opts.get('type', 'bzip2').lower() | 1240 bundletype = opts.get('type', 'bzip2').lower() |
1241 btypes = {'none': 'HG10UN', | 1241 bundletype = cmdutil.parsebundletype(bundletype) |
1242 'bzip2': 'HG10BZ', | |
1243 'gzip': 'HG10GZ', | |
1244 'bundle2': 'HG20'} | |
1245 bundletype = btypes.get(bundletype) | |
1246 if bundletype not in changegroup.bundletypes: | |
1247 raise util.Abort(_('unknown bundle type specified with --type')) | |
1248 | 1242 |
1249 if opts.get('all'): | 1243 if opts.get('all'): |
1250 base = ['null'] | 1244 base = ['null'] |
1251 else: | 1245 else: |
1252 base = scmutil.revrange(repo, opts.get('base')) | 1246 base = scmutil.revrange(repo, opts.get('base')) |