diff mercurial/exchange.py @ 34098: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 f85dfde1731a
children 5ede882c249c
line wrap: on
line diff
--- 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)