comparison mercurial/commands.py @ 23896:becfecaf9087

changegroup.writebundle: HG2Y support This diff adds support to writebundle to generate a bundle2 wrapper; upcoming diffs will add an option to write a v2 changegroup part instead of v1 in these bundles.
author Eric Sumner <ericsumner@fb.com>
date Thu, 15 Jan 2015 15:39:16 -0800
parents cda18ded2c48
children fafd9a1284cf
comparison
equal deleted inserted replaced
23895:cda18ded2c48 23896:becfecaf9087
1179 revs = None 1179 revs = None
1180 if 'rev' in opts: 1180 if 'rev' in opts:
1181 revs = scmutil.revrange(repo, opts['rev']) 1181 revs = scmutil.revrange(repo, opts['rev'])
1182 1182
1183 bundletype = opts.get('type', 'bzip2').lower() 1183 bundletype = opts.get('type', 'bzip2').lower()
1184 btypes = {'none': 'HG10UN', 'bzip2': 'HG10BZ', 'gzip': 'HG10GZ'} 1184 btypes = {'none': 'HG10UN',
1185 'bzip2': 'HG10BZ',
1186 'gzip': 'HG10GZ',
1187 'bundle2': 'HG2Y'}
1185 bundletype = btypes.get(bundletype) 1188 bundletype = btypes.get(bundletype)
1186 if bundletype not in changegroup.bundletypes: 1189 if bundletype not in changegroup.bundletypes:
1187 raise util.Abort(_('unknown bundle type specified with --type')) 1190 raise util.Abort(_('unknown bundle type specified with --type'))
1188 1191
1189 if opts.get('all'): 1192 if opts.get('all'):
2159 # TODO: get desired bundlecaps from command line. 2162 # TODO: get desired bundlecaps from command line.
2160 args['bundlecaps'] = None 2163 args['bundlecaps'] = None
2161 bundle = repo.getbundle('debug', **args) 2164 bundle = repo.getbundle('debug', **args)
2162 2165
2163 bundletype = opts.get('type', 'bzip2').lower() 2166 bundletype = opts.get('type', 'bzip2').lower()
2164 btypes = {'none': 'HG10UN', 'bzip2': 'HG10BZ', 'gzip': 'HG10GZ'} 2167 btypes = {'none': 'HG10UN',
2168 'bzip2': 'HG10BZ',
2169 'gzip': 'HG10GZ',
2170 'bundle2': 'HG2Y'}
2165 bundletype = btypes.get(bundletype) 2171 bundletype = btypes.get(bundletype)
2166 if bundletype not in changegroup.bundletypes: 2172 if bundletype not in changegroup.bundletypes:
2167 raise util.Abort(_('unknown bundle type specified with --type')) 2173 raise util.Abort(_('unknown bundle type specified with --type'))
2168 changegroup.writebundle(ui, bundle, bundlepath, bundletype) 2174 changegroup.writebundle(ui, bundle, bundlepath, bundletype)
2169 2175