[PATCH 1 of 2] exchange: get rid of "getcgkwargs" variable

Martin von Zweigbergk martinvonz at google.com
Mon Mar 28 17:59:02 EDT 2016


# HG changeset patch
# User Martin von Zweigbergk <martinvonz at google.com>
# Date 1458946900 25200
#      Fri Mar 25 16:01:40 2016 -0700
# Node ID 2f99e84dc6a77f890e0821480325da7c86b2ede7
# Parent  5474dc73680f96e79ae3c255fb01b7943b2fc2d1
exchange: get rid of "getcgkwargs" variable

This also makes the "version" argument explicit (never relies on
getlocalchangegroupraw()'s default), which I think is a good thing.

diff -r 5474dc73680f -r 2f99e84dc6a7 mercurial/exchange.py
--- a/mercurial/exchange.py	Mon Mar 28 09:12:03 2016 +0200
+++ b/mercurial/exchange.py	Fri Mar 25 16:01:40 2016 -0700
@@ -1559,23 +1559,22 @@
     cg = None
     if kwargs.get('cg', True):
         # build changegroup bundle here.
-        version = None
+        version = '01'
         cgversions = b2caps.get('changegroup')
-        getcgkwargs = {}
         if cgversions:  # 3.1 and 3.2 ship with an empty value
             cgversions = [v for v in cgversions
                           if v in changegroup.supportedoutgoingversions(repo)]
             if not cgversions:
                 raise ValueError(_('no common changegroup version'))
-            version = getcgkwargs['version'] = max(cgversions)
+            version = max(cgversions)
         outgoing = changegroup.computeoutgoing(repo, heads, common)
         cg = changegroup.getlocalchangegroupraw(repo, source, outgoing,
                                                 bundlecaps=bundlecaps,
-                                                **getcgkwargs)
+                                                version=version)
 
     if cg:
         part = bundler.newpart('changegroup', data=cg)
-        if version is not None:
+        if cgversions:
             part.addparam('version', version)
         part.addparam('nbchanges', str(len(outgoing.missing)), mandatory=False)
         if 'treemanifest' in repo.requirements:


More information about the Mercurial-devel mailing list