getbundle: have a single getchangegroupraw call site
Having a single call site will simplify the code and help with coming refactoring.
--- 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)