changeset 34113:d8245139e720

changegroup: replace getlocalchangegroupraw with makestream As part of reducing the number of changegroup creation apis, let's replace calls to getlocalchangegroupraw with calls to makestream. Aside from one case of checking if there are no outgoing commits and returning None, this is pretty much a drop in replacement. Differential Revision: https://phab.mercurial-scm.org/D666
author Durham Goode <durham@fb.com>
date Sun, 10 Sep 2017 19:01:56 -0700
parents f7d41b85bbf6
children 6097a616178d
files mercurial/changegroup.py mercurial/exchange.py
diffstat 2 files changed, 8 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/changegroup.py	Sun Sep 10 18:43:59 2017 -0700
+++ b/mercurial/changegroup.py	Sun Sep 10 19:01:56 2017 -0700
@@ -940,17 +940,6 @@
     _changegroupinfo(repo, csets, source)
     return bundler.generate(commonrevs, csets, fastpathlinkrev, source)
 
-def getlocalchangegroupraw(repo, source, outgoing, bundlecaps=None,
-                           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)
-    return getsubsetraw(repo, outgoing, bundler, source)
-
 def getchangegroup(repo, source, outgoing, bundlecaps=None,
                    version='01'):
     """Like getbundle, but taking a discovery.outgoing as an argument.
--- a/mercurial/exchange.py	Sun Sep 10 18:43:59 2017 -0700
+++ b/mercurial/exchange.py	Sun Sep 10 19:01:56 2017 -0700
@@ -755,10 +755,9 @@
         if not cgversions:
             raise ValueError(_('no common changegroup version'))
         version = max(cgversions)
-    cg = changegroup.getlocalchangegroupraw(pushop.repo, 'push',
-                                            pushop.outgoing,
-                                            version=version)
-    cgpart = bundler.newpart('changegroup', data=cg)
+    cgstream = changegroup.makestream(pushop.repo, pushop.outgoing, version,
+                                      'push')
+    cgpart = bundler.newpart('changegroup', data=cgstream)
     if cgversions:
         cgpart.addparam('version', version)
     if 'treemanifest' in pushop.repo.requirements:
@@ -1621,7 +1620,7 @@
 def _getbundlechangegrouppart(bundler, repo, source, bundlecaps=None,
                               b2caps=None, heads=None, common=None, **kwargs):
     """add a changegroup part to the requested bundle"""
-    cg = None
+    cgstream = None
     if kwargs.get('cg', True):
         # build changegroup bundle here.
         version = '01'
@@ -1633,12 +1632,11 @@
                 raise ValueError(_('no common changegroup version'))
             version = max(cgversions)
         outgoing = _computeoutgoing(repo, heads, common)
-        cg = changegroup.getlocalchangegroupraw(repo, source, outgoing,
-                                                bundlecaps=bundlecaps,
-                                                version=version)
+        cgstream = changegroup.makestream(repo, outgoing, version, source,
+                                          bundlecaps=bundlecaps)
 
-    if cg:
-        part = bundler.newpart('changegroup', data=cg)
+    if cgstream:
+        part = bundler.newpart('changegroup', data=cgstream)
         if cgversions:
             part.addparam('version', version)
         part.addparam('nbchanges', str(len(outgoing.missing)), mandatory=False)