##// END OF EJS Templates
changegroup: delete unused 'bundlecaps' argument (API)
Martin von Zweigbergk -
r32150:282b288a default
parent child Browse files
Show More
@@ -502,16 +502,9 b' class headerlessfixup(object):'
502 class cg1packer(object):
502 class cg1packer(object):
503 deltaheader = _CHANGEGROUPV1_DELTA_HEADER
503 deltaheader = _CHANGEGROUPV1_DELTA_HEADER
504 version = '01'
504 version = '01'
505 def __init__(self, repo, bundlecaps=None):
505 def __init__(self, repo):
506 """Given a source repo, construct a bundler.
506 """Given a source repo, construct a bundler.
507
508 bundlecaps is optional and can be used to specify the set of
509 capabilities which can be used to build the bundle.
510 """
507 """
511 # Set of capabilities we can use to build the bundle.
512 if bundlecaps is None:
513 bundlecaps = set()
514 self._bundlecaps = bundlecaps
515 # experimental config: bundle.reorder
508 # experimental config: bundle.reorder
516 reorder = repo.ui.config('bundle', 'reorder', 'auto')
509 reorder = repo.ui.config('bundle', 'reorder', 'auto')
517 if reorder == 'auto':
510 if reorder == 'auto':
@@ -815,8 +808,8 b' class cg2packer(cg1packer):'
815 version = '02'
808 version = '02'
816 deltaheader = _CHANGEGROUPV2_DELTA_HEADER
809 deltaheader = _CHANGEGROUPV2_DELTA_HEADER
817
810
818 def __init__(self, repo, bundlecaps=None):
811 def __init__(self, repo):
819 super(cg2packer, self).__init__(repo, bundlecaps)
812 super(cg2packer, self).__init__(repo)
820 if self._reorder is None:
813 if self._reorder is None:
821 # Since generaldelta is directly supported by cg2, reordering
814 # Since generaldelta is directly supported by cg2, reordering
822 # generally doesn't help, so we disable it by default (treating
815 # generally doesn't help, so we disable it by default (treating
@@ -910,9 +903,9 b' def safeversion(repo):'
910 assert versions
903 assert versions
911 return min(versions)
904 return min(versions)
912
905
913 def getbundler(version, repo, bundlecaps=None):
906 def getbundler(version, repo):
914 assert version in supportedoutgoingversions(repo)
907 assert version in supportedoutgoingversions(repo)
915 return _packermap[version][0](repo, bundlecaps)
908 return _packermap[version][0](repo)
916
909
917 def getunbundler(version, fh, alg, extras=None):
910 def getunbundler(version, fh, alg, extras=None):
918 return _packermap[version][1](fh, alg, extras=extras)
911 return _packermap[version][1](fh, alg, extras=extras)
@@ -963,30 +956,27 b' def changegroupsubset(repo, roots, heads'
963 bundler = getbundler(version, repo)
956 bundler = getbundler(version, repo)
964 return getsubset(repo, outgoing, bundler, source)
957 return getsubset(repo, outgoing, bundler, source)
965
958
966 def getlocalchangegroupraw(repo, source, outgoing, bundlecaps=None,
959 def getlocalchangegroupraw(repo, source, outgoing, version='01'):
967 version='01'):
968 """Like getbundle, but taking a discovery.outgoing as an argument.
960 """Like getbundle, but taking a discovery.outgoing as an argument.
969
961
970 This is only implemented for local repos and reuses potentially
962 This is only implemented for local repos and reuses potentially
971 precomputed sets in outgoing. Returns a raw changegroup generator."""
963 precomputed sets in outgoing. Returns a raw changegroup generator."""
972 if not outgoing.missing:
964 if not outgoing.missing:
973 return None
965 return None
974 bundler = getbundler(version, repo, bundlecaps)
966 bundler = getbundler(version, repo)
975 return getsubsetraw(repo, outgoing, bundler, source)
967 return getsubsetraw(repo, outgoing, bundler, source)
976
968
977 def getlocalchangegroup(repo, source, outgoing, bundlecaps=None,
969 def getlocalchangegroup(repo, source, outgoing, version='01'):
978 version='01'):
979 """Like getbundle, but taking a discovery.outgoing as an argument.
970 """Like getbundle, but taking a discovery.outgoing as an argument.
980
971
981 This is only implemented for local repos and reuses potentially
972 This is only implemented for local repos and reuses potentially
982 precomputed sets in outgoing."""
973 precomputed sets in outgoing."""
983 if not outgoing.missing:
974 if not outgoing.missing:
984 return None
975 return None
985 bundler = getbundler(version, repo, bundlecaps)
976 bundler = getbundler(version, repo)
986 return getsubset(repo, outgoing, bundler, source)
977 return getsubset(repo, outgoing, bundler, source)
987
978
988 def getchangegroup(repo, source, outgoing, bundlecaps=None,
979 def getchangegroup(repo, source, outgoing, version='01'):
989 version='01'):
990 """Like changegroupsubset, but returns the set difference between the
980 """Like changegroupsubset, but returns the set difference between the
991 ancestors of heads and the ancestors common.
981 ancestors of heads and the ancestors common.
992
982
@@ -995,8 +985,7 b' def getchangegroup(repo, source, outgoin'
995 The nodes in common might not all be known locally due to the way the
985 The nodes in common might not all be known locally due to the way the
996 current discovery protocol works.
986 current discovery protocol works.
997 """
987 """
998 return getlocalchangegroup(repo, source, outgoing, bundlecaps=bundlecaps,
988 return getlocalchangegroup(repo, source, outgoing, version=version)
999 version=version)
1000
989
1001 def changegroup(repo, basenodes, source):
990 def changegroup(repo, basenodes, source):
1002 # to avoid a race we use changegroupsubset() (issue1320)
991 # to avoid a race we use changegroupsubset() (issue1320)
@@ -1346,8 +1346,6 b' def bundle(ui, repo, fname, dest=None, *'
1346 base = ['null']
1346 base = ['null']
1347 else:
1347 else:
1348 base = scmutil.revrange(repo, opts.get('base'))
1348 base = scmutil.revrange(repo, opts.get('base'))
1349 # TODO: get desired bundlecaps from command line.
1350 bundlecaps = None
1351 if cgversion not in changegroup.supportedoutgoingversions(repo):
1349 if cgversion not in changegroup.supportedoutgoingversions(repo):
1352 raise error.Abort(_("repository does not support bundle version %s") %
1350 raise error.Abort(_("repository does not support bundle version %s") %
1353 cgversion)
1351 cgversion)
@@ -1360,7 +1358,6 b' def bundle(ui, repo, fname, dest=None, *'
1360 heads = revs and map(repo.lookup, revs) or None
1358 heads = revs and map(repo.lookup, revs) or None
1361 outgoing = discovery.outgoing(repo, common, heads)
1359 outgoing = discovery.outgoing(repo, common, heads)
1362 cg = changegroup.getchangegroup(repo, 'bundle', outgoing,
1360 cg = changegroup.getchangegroup(repo, 'bundle', outgoing,
1363 bundlecaps=bundlecaps,
1364 version=cgversion)
1361 version=cgversion)
1365 outgoing = None
1362 outgoing = None
1366 else:
1363 else:
@@ -1374,7 +1371,7 b' def bundle(ui, repo, fname, dest=None, *'
1374 force=opts.get('force'),
1371 force=opts.get('force'),
1375 portable=True)
1372 portable=True)
1376 cg = changegroup.getlocalchangegroup(repo, 'bundle', outgoing,
1373 cg = changegroup.getlocalchangegroup(repo, 'bundle', outgoing,
1377 bundlecaps, version=cgversion)
1374 version=cgversion)
1378 if not cg:
1375 if not cg:
1379 scmutil.nochangesfound(ui, repo, outgoing and outgoing.excluded)
1376 scmutil.nochangesfound(ui, repo, outgoing and outgoing.excluded)
1380 return 1
1377 return 1
@@ -938,22 +938,19 b' def _pushchangeset(pushop):'
938 pushop.repo.prepushoutgoinghooks(pushop)
938 pushop.repo.prepushoutgoinghooks(pushop)
939 outgoing = pushop.outgoing
939 outgoing = pushop.outgoing
940 unbundle = pushop.remote.capable('unbundle')
940 unbundle = pushop.remote.capable('unbundle')
941 # TODO: get bundlecaps from remote
942 bundlecaps = None
943 # create a changegroup from local
941 # create a changegroup from local
944 if pushop.revs is None and not (outgoing.excluded
942 if pushop.revs is None and not (outgoing.excluded
945 or pushop.repo.changelog.filteredrevs):
943 or pushop.repo.changelog.filteredrevs):
946 # push everything,
944 # push everything,
947 # use the fast path, no race possible on push
945 # use the fast path, no race possible on push
948 bundler = changegroup.cg1packer(pushop.repo, bundlecaps)
946 bundler = changegroup.cg1packer(pushop.repo)
949 cg = changegroup.getsubset(pushop.repo,
947 cg = changegroup.getsubset(pushop.repo,
950 outgoing,
948 outgoing,
951 bundler,
949 bundler,
952 'push',
950 'push',
953 fastpath=True)
951 fastpath=True)
954 else:
952 else:
955 cg = changegroup.getlocalchangegroup(pushop.repo, 'push', outgoing,
953 cg = changegroup.getlocalchangegroup(pushop.repo, 'push', outgoing)
956 bundlecaps)
957
954
958 # apply changegroup to remote
955 # apply changegroup to remote
959 if unbundle:
956 if unbundle:
@@ -1578,7 +1575,7 b' def getbundlechunks(repo, source, heads='
1578 raise ValueError(_('unsupported getbundle arguments: %s')
1575 raise ValueError(_('unsupported getbundle arguments: %s')
1579 % ', '.join(sorted(kwargs.keys())))
1576 % ', '.join(sorted(kwargs.keys())))
1580 outgoing = _computeoutgoing(repo, heads, common)
1577 outgoing = _computeoutgoing(repo, heads, common)
1581 bundler = changegroup.getbundler('01', repo, bundlecaps)
1578 bundler = changegroup.getbundler('01', repo)
1582 return changegroup.getsubsetraw(repo, outgoing, bundler, source)
1579 return changegroup.getsubsetraw(repo, outgoing, bundler, source)
1583
1580
1584 # bundle20 case
1581 # bundle20 case
@@ -1616,7 +1613,6 b' def _getbundlechangegrouppart(bundler, r'
1616 version = max(cgversions)
1613 version = max(cgversions)
1617 outgoing = _computeoutgoing(repo, heads, common)
1614 outgoing = _computeoutgoing(repo, heads, common)
1618 cg = changegroup.getlocalchangegroupraw(repo, source, outgoing,
1615 cg = changegroup.getlocalchangegroupraw(repo, source, outgoing,
1619 bundlecaps=bundlecaps,
1620 version=version)
1616 version=version)
1621
1617
1622 if cg:
1618 if cg:
@@ -113,7 +113,7 b' Create an extension to test bundle2 API'
113 > headmissing = [c.node() for c in repo.set('heads(%ld)', revs)]
113 > headmissing = [c.node() for c in repo.set('heads(%ld)', revs)]
114 > headcommon = [c.node() for c in repo.set('parents(%ld) - %ld', revs, revs)]
114 > headcommon = [c.node() for c in repo.set('parents(%ld) - %ld', revs, revs)]
115 > outgoing = discovery.outgoing(repo, headcommon, headmissing)
115 > outgoing = discovery.outgoing(repo, headcommon, headmissing)
116 > cg = changegroup.getlocalchangegroup(repo, 'test:bundle2', outgoing, None)
116 > cg = changegroup.getlocalchangegroup(repo, 'test:bundle2', outgoing)
117 > bundler.newpart('changegroup', data=cg.getchunks(),
117 > bundler.newpart('changegroup', data=cg.getchunks(),
118 > mandatory=False)
118 > mandatory=False)
119 >
119 >
@@ -13,13 +13,11 b' Create an extension to test bundle2 with'
13 > # in 'heads' as intermediate heads for the first changegroup.
13 > # in 'heads' as intermediate heads for the first changegroup.
14 > intermediates = [repo[r].p1().node() for r in heads]
14 > intermediates = [repo[r].p1().node() for r in heads]
15 > outgoing = discovery.outgoing(repo, common, intermediates)
15 > outgoing = discovery.outgoing(repo, common, intermediates)
16 > cg = changegroup.getchangegroup(repo, source, outgoing,
16 > cg = changegroup.getchangegroup(repo, source, outgoing)
17 > bundlecaps=bundlecaps)
18 > bundler.newpart('output', data='changegroup1')
17 > bundler.newpart('output', data='changegroup1')
19 > bundler.newpart('changegroup', data=cg.getchunks())
18 > bundler.newpart('changegroup', data=cg.getchunks())
20 > outgoing = discovery.outgoing(repo, common + intermediates, heads)
19 > outgoing = discovery.outgoing(repo, common + intermediates, heads)
21 > cg = changegroup.getchangegroup(repo, source, outgoing,
20 > cg = changegroup.getchangegroup(repo, source, outgoing)
22 > bundlecaps=bundlecaps)
23 > bundler.newpart('output', data='changegroup2')
21 > bundler.newpart('output', data='changegroup2')
24 > bundler.newpart('changegroup', data=cg.getchunks())
22 > bundler.newpart('changegroup', data=cg.getchunks())
25 >
23 >
General Comments 0
You need to be logged in to leave comments. Login now