changeset 25503:1b7853a1f04e

getbundle: have a single getchangegroupraw call site Having a single call site will simplify the code and help with coming refactoring.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Sun, 07 Jun 2015 15:47:07 -0700
parents bd41c19383db
children 60f4e7022ffe
files mercurial/exchange.py
diffstat 1 files changed, 7 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/exchange.py	Wed May 27 22:25:51 2015 -0700
+++ b/mercurial/exchange.py	Sun Jun 07 15:47:07 2015 -0700
@@ -1288,19 +1288,16 @@
         # build changegroup bundle here.
         version = None
         cgversions = b2caps.get('changegroup')
-        if not cgversions:  # 3.1 and 3.2 ship with an empty value
-            cg = changegroup.getchangegroupraw(repo, source, heads=heads,
-                                               common=common,
-                                               bundlecaps=bundlecaps)
-        else:
+        getcgkwargs = {}
+        if cgversions:  # 3.1 and 3.2 ship with an empty value
             cgversions = [v for v in cgversions if v in changegroup.packermap]
             if not cgversions:
                 raise ValueError(_('no common changegroup version'))
-            version = max(cgversions)
-            cg = changegroup.getchangegroupraw(repo, source, heads=heads,
-                                               common=common,
-                                               bundlecaps=bundlecaps,
-                                               version=version)
+            version = getcgkwargs['version'] = max(cgversions)
+        cg = changegroup.getchangegroupraw(repo, source, heads=heads,
+                                           common=common,
+                                           bundlecaps=bundlecaps,
+                                           **getcgkwargs)
 
     if cg:
         part = bundler.newpart('changegroup', data=cg)