changeset 32199:282b288aa20c

changegroup: delete unused 'bundlecaps' argument (API)
author Martin von Zweigbergk <martinvonz@google.com>
date Tue, 02 May 2017 23:47:10 -0700
parents 9a9d54ae9963
children 4d504e541d3d
files mercurial/changegroup.py mercurial/commands.py mercurial/exchange.py tests/test-bundle2-format.t tests/test-bundle2-multiple-changegroups.t
diffstat 5 files changed, 18 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/changegroup.py	Wed May 03 10:33:26 2017 -0700
+++ b/mercurial/changegroup.py	Tue May 02 23:47:10 2017 -0700
@@ -502,16 +502,9 @@
 class cg1packer(object):
     deltaheader = _CHANGEGROUPV1_DELTA_HEADER
     version = '01'
-    def __init__(self, repo, bundlecaps=None):
+    def __init__(self, repo):
         """Given a source repo, construct a bundler.
-
-        bundlecaps is optional and can be used to specify the set of
-        capabilities which can be used to build the bundle.
         """
-        # Set of capabilities we can use to build the bundle.
-        if bundlecaps is None:
-            bundlecaps = set()
-        self._bundlecaps = bundlecaps
         # experimental config: bundle.reorder
         reorder = repo.ui.config('bundle', 'reorder', 'auto')
         if reorder == 'auto':
@@ -815,8 +808,8 @@
     version = '02'
     deltaheader = _CHANGEGROUPV2_DELTA_HEADER
 
-    def __init__(self, repo, bundlecaps=None):
-        super(cg2packer, self).__init__(repo, bundlecaps)
+    def __init__(self, repo):
+        super(cg2packer, self).__init__(repo)
         if self._reorder is None:
             # Since generaldelta is directly supported by cg2, reordering
             # generally doesn't help, so we disable it by default (treating
@@ -910,9 +903,9 @@
     assert versions
     return min(versions)
 
-def getbundler(version, repo, bundlecaps=None):
+def getbundler(version, repo):
     assert version in supportedoutgoingversions(repo)
-    return _packermap[version][0](repo, bundlecaps)
+    return _packermap[version][0](repo)
 
 def getunbundler(version, fh, alg, extras=None):
     return _packermap[version][1](fh, alg, extras=extras)
@@ -963,30 +956,27 @@
     bundler = getbundler(version, repo)
     return getsubset(repo, outgoing, bundler, source)
 
-def getlocalchangegroupraw(repo, source, outgoing, bundlecaps=None,
-                           version='01'):
+def getlocalchangegroupraw(repo, source, outgoing, version='01'):
     """Like getbundle, but taking a discovery.outgoing as an argument.
 
     This is only implemented for local repos and reuses potentially
     precomputed sets in outgoing. Returns a raw changegroup generator."""
     if not outgoing.missing:
         return None
-    bundler = getbundler(version, repo, bundlecaps)
+    bundler = getbundler(version, repo)
     return getsubsetraw(repo, outgoing, bundler, source)
 
-def getlocalchangegroup(repo, source, outgoing, bundlecaps=None,
-                        version='01'):
+def getlocalchangegroup(repo, source, outgoing, version='01'):
     """Like getbundle, but taking a discovery.outgoing as an argument.
 
     This is only implemented for local repos and reuses potentially
     precomputed sets in outgoing."""
     if not outgoing.missing:
         return None
-    bundler = getbundler(version, repo, bundlecaps)
+    bundler = getbundler(version, repo)
     return getsubset(repo, outgoing, bundler, source)
 
-def getchangegroup(repo, source, outgoing, bundlecaps=None,
-                   version='01'):
+def getchangegroup(repo, source, outgoing, version='01'):
     """Like changegroupsubset, but returns the set difference between the
     ancestors of heads and the ancestors common.
 
@@ -995,8 +985,7 @@
     The nodes in common might not all be known locally due to the way the
     current discovery protocol works.
     """
-    return getlocalchangegroup(repo, source, outgoing, bundlecaps=bundlecaps,
-                               version=version)
+    return getlocalchangegroup(repo, source, outgoing, version=version)
 
 def changegroup(repo, basenodes, source):
     # to avoid a race we use changegroupsubset() (issue1320)
--- a/mercurial/commands.py	Wed May 03 10:33:26 2017 -0700
+++ b/mercurial/commands.py	Tue May 02 23:47:10 2017 -0700
@@ -1346,8 +1346,6 @@
         base = ['null']
     else:
         base = scmutil.revrange(repo, opts.get('base'))
-    # TODO: get desired bundlecaps from command line.
-    bundlecaps = None
     if cgversion not in changegroup.supportedoutgoingversions(repo):
         raise error.Abort(_("repository does not support bundle version %s") %
                           cgversion)
@@ -1360,7 +1358,6 @@
         heads = revs and map(repo.lookup, revs) or None
         outgoing = discovery.outgoing(repo, common, heads)
         cg = changegroup.getchangegroup(repo, 'bundle', outgoing,
-                                        bundlecaps=bundlecaps,
                                         version=cgversion)
         outgoing = None
     else:
@@ -1374,7 +1371,7 @@
                                                 force=opts.get('force'),
                                                 portable=True)
         cg = changegroup.getlocalchangegroup(repo, 'bundle', outgoing,
-                                                bundlecaps, version=cgversion)
+                                             version=cgversion)
     if not cg:
         scmutil.nochangesfound(ui, repo, outgoing and outgoing.excluded)
         return 1
--- a/mercurial/exchange.py	Wed May 03 10:33:26 2017 -0700
+++ b/mercurial/exchange.py	Tue May 02 23:47:10 2017 -0700
@@ -938,22 +938,19 @@
     pushop.repo.prepushoutgoinghooks(pushop)
     outgoing = pushop.outgoing
     unbundle = pushop.remote.capable('unbundle')
-    # TODO: get bundlecaps from remote
-    bundlecaps = None
     # create a changegroup from local
     if pushop.revs is None and not (outgoing.excluded
                             or pushop.repo.changelog.filteredrevs):
         # push everything,
         # use the fast path, no race possible on push
-        bundler = changegroup.cg1packer(pushop.repo, bundlecaps)
+        bundler = changegroup.cg1packer(pushop.repo)
         cg = changegroup.getsubset(pushop.repo,
                                    outgoing,
                                    bundler,
                                    'push',
                                    fastpath=True)
     else:
-        cg = changegroup.getlocalchangegroup(pushop.repo, 'push', outgoing,
-                                        bundlecaps)
+        cg = changegroup.getlocalchangegroup(pushop.repo, 'push', outgoing)
 
     # apply changegroup to remote
     if unbundle:
@@ -1578,7 +1575,7 @@
             raise ValueError(_('unsupported getbundle arguments: %s')
                              % ', '.join(sorted(kwargs.keys())))
         outgoing = _computeoutgoing(repo, heads, common)
-        bundler = changegroup.getbundler('01', repo, bundlecaps)
+        bundler = changegroup.getbundler('01', repo)
         return changegroup.getsubsetraw(repo, outgoing, bundler, source)
 
     # bundle20 case
@@ -1616,7 +1613,6 @@
             version = max(cgversions)
         outgoing = _computeoutgoing(repo, heads, common)
         cg = changegroup.getlocalchangegroupraw(repo, source, outgoing,
-                                                bundlecaps=bundlecaps,
                                                 version=version)
 
     if cg:
--- a/tests/test-bundle2-format.t	Wed May 03 10:33:26 2017 -0700
+++ b/tests/test-bundle2-format.t	Tue May 02 23:47:10 2017 -0700
@@ -113,7 +113,7 @@
   >             headmissing = [c.node() for c in repo.set('heads(%ld)', revs)]
   >             headcommon  = [c.node() for c in repo.set('parents(%ld) - %ld', revs, revs)]
   >             outgoing = discovery.outgoing(repo, headcommon, headmissing)
-  >             cg = changegroup.getlocalchangegroup(repo, 'test:bundle2', outgoing, None)
+  >             cg = changegroup.getlocalchangegroup(repo, 'test:bundle2', outgoing)
   >             bundler.newpart('changegroup', data=cg.getchunks(),
   >                             mandatory=False)
   > 
--- a/tests/test-bundle2-multiple-changegroups.t	Wed May 03 10:33:26 2017 -0700
+++ b/tests/test-bundle2-multiple-changegroups.t	Tue May 02 23:47:10 2017 -0700
@@ -13,13 +13,11 @@
   >     # in 'heads' as intermediate heads for the first changegroup.
   >     intermediates = [repo[r].p1().node() for r in heads]
   >     outgoing = discovery.outgoing(repo, common, intermediates)
-  >     cg = changegroup.getchangegroup(repo, source, outgoing,
-  >                                     bundlecaps=bundlecaps)
+  >     cg = changegroup.getchangegroup(repo, source, outgoing)
   >     bundler.newpart('output', data='changegroup1')
   >     bundler.newpart('changegroup', data=cg.getchunks())
   >     outgoing = discovery.outgoing(repo, common + intermediates, heads)
-  >     cg = changegroup.getchangegroup(repo, source, outgoing,
-  >                                     bundlecaps=bundlecaps)
+  >     cg = changegroup.getchangegroup(repo, source, outgoing)
   >     bundler.newpart('output', data='changegroup2')
   >     bundler.newpart('changegroup', data=cg.getchunks())
   >