comparison mercurial/commands.py @ 19201:309c439cdbaa

bundle-ng: add bundlecaps argument to getbundle() command
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Sat, 09 Feb 2013 23:42:03 +0100
parents 05390cfe678a
children 4b9e5b71dfa9
comparison
equal deleted inserted replaced
19200:4cfdec944edf 19201:309c439cdbaa
1094 1094
1095 if opts.get('all'): 1095 if opts.get('all'):
1096 base = ['null'] 1096 base = ['null']
1097 else: 1097 else:
1098 base = scmutil.revrange(repo, opts.get('base')) 1098 base = scmutil.revrange(repo, opts.get('base'))
1099 # TODO: get desired bundlecaps from command line.
1100 bundlecaps = None
1099 if base: 1101 if base:
1100 if dest: 1102 if dest:
1101 raise util.Abort(_("--base is incompatible with specifying " 1103 raise util.Abort(_("--base is incompatible with specifying "
1102 "a destination")) 1104 "a destination"))
1103 common = [repo.lookup(rev) for rev in base] 1105 common = [repo.lookup(rev) for rev in base]
1104 heads = revs and map(repo.lookup, revs) or revs 1106 heads = revs and map(repo.lookup, revs) or revs
1105 cg = repo.getbundle('bundle', heads=heads, common=common) 1107 cg = repo.getbundle('bundle', heads=heads, common=common,
1108 bundlecaps=bundlecaps)
1106 outgoing = None 1109 outgoing = None
1107 else: 1110 else:
1108 dest = ui.expandpath(dest or 'default-push', dest or 'default') 1111 dest = ui.expandpath(dest or 'default-push', dest or 'default')
1109 dest, branches = hg.parseurl(dest, opts.get('branch')) 1112 dest, branches = hg.parseurl(dest, opts.get('branch'))
1110 other = hg.peer(repo, opts, dest) 1113 other = hg.peer(repo, opts, dest)
1112 heads = revs and map(repo.lookup, revs) or revs 1115 heads = revs and map(repo.lookup, revs) or revs
1113 outgoing = discovery.findcommonoutgoing(repo, other, 1116 outgoing = discovery.findcommonoutgoing(repo, other,
1114 onlyheads=heads, 1117 onlyheads=heads,
1115 force=opts.get('force'), 1118 force=opts.get('force'),
1116 portable=True) 1119 portable=True)
1117 cg = repo.getlocalbundle('bundle', outgoing) 1120 cg = repo.getlocalbundle('bundle', outgoing, bundlecaps)
1118 if not cg: 1121 if not cg:
1119 scmutil.nochangesfound(ui, repo, outgoing and outgoing.excluded) 1122 scmutil.nochangesfound(ui, repo, outgoing and outgoing.excluded)
1120 return 1 1123 return 1
1121 1124
1122 changegroup.writebundle(cg, fname, bundletype) 1125 changegroup.writebundle(cg, fname, bundletype)
1911 args = {} 1914 args = {}
1912 if common: 1915 if common:
1913 args['common'] = [bin(s) for s in common] 1916 args['common'] = [bin(s) for s in common]
1914 if head: 1917 if head:
1915 args['heads'] = [bin(s) for s in head] 1918 args['heads'] = [bin(s) for s in head]
1919 # TODO: get desired bundlecaps from command line.
1920 args['bundlecaps'] = None
1916 bundle = repo.getbundle('debug', **args) 1921 bundle = repo.getbundle('debug', **args)
1917 1922
1918 bundletype = opts.get('type', 'bzip2').lower() 1923 bundletype = opts.get('type', 'bzip2').lower()
1919 btypes = {'none': 'HG10UN', 'bzip2': 'HG10BZ', 'gzip': 'HG10GZ'} 1924 btypes = {'none': 'HG10UN', 'bzip2': 'HG10BZ', 'gzip': 'HG10GZ'}
1920 bundletype = btypes.get(bundletype) 1925 bundletype = btypes.get(bundletype)