Patchwork [2,of,4] changegroup: add version argument to getchangegroup

login
register
mail settings
Submitter Pierre-Yves David
Date Oct. 2, 2015, 3:32 a.m.
Message ID <5ae2e2fc8c3e83335872.1443756748@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/10732/
State Accepted
Headers show

Comments

Pierre-Yves David - Oct. 2, 2015, 3:32 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1443752087 25200
#      Thu Oct 01 19:14:47 2015 -0700
# Node ID 5ae2e2fc8c3e833358725fc1305829d9c1570c25
# Parent  e93790d473f2a876ffb50101ba8dfc0dc71e15f5
changegroup: add version argument to getchangegroup

For some obscure reasons (probably upsetting a Greek goddess),
getchangegroup did not had a 'version' argument to control the changegroup
version. We fixes this to allow cg02 to be used with 'hg bundle' in the future.

Patch

diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -643,21 +643,23 @@  def computeoutgoing(repo, heads, common)
         common = [nullid]
     if not heads:
         heads = cl.heads()
     return discovery.outgoing(cl, common, heads)
 
-def getchangegroup(repo, source, heads=None, common=None, bundlecaps=None):
+def getchangegroup(repo, source, heads=None, common=None, bundlecaps=None,
+                   version='01'):
     """Like changegroupsubset, but returns the set difference between the
     ancestors of heads and the ancestors common.
 
     If heads is None, use the local heads. If common is None, use [nullid].
 
     The nodes in common might not all be known locally due to the way the
     current discovery protocol works.
     """
     outgoing = computeoutgoing(repo, heads, common)
-    return getlocalchangegroup(repo, source, outgoing, bundlecaps=bundlecaps)
+    return getlocalchangegroup(repo, source, outgoing, bundlecaps=bundlecaps,
+                               version=version)
 
 def changegroup(repo, basenodes, source):
     # to avoid a race we use changegroupsubset() (issue1320)
     return changegroupsubset(repo, basenodes, repo.heads(), source)