[PATCH 7 of 8] changegroup: allow use of cg2packer in getchangegroupraw
Sune Foldager
sune.foldager at me.com
Fri Oct 17 13:14:58 UTC 2014
# HG changeset patch
# User Sune Foldager <cryo at cyanite.org>
# Date 1413549681 -7200
# Fri Oct 17 14:41:21 2014 +0200
# Node ID 7b3ef1e1d1d40c5838f2df7afaf6d4029855c1ed
# Parent 958fbc8c90b8d2e5eab44909e99705e615375b78
changegroup: allow use of cg2packer in getchangegroupraw
Also, exchange now explicitly sets the changegroup version
for bundle2 changegroups.
diff -r 958fbc8c90b8 -r 7b3ef1e1d1d4 mercurial/changegroup.py
--- a/mercurial/changegroup.py Fri Oct 17 14:41:11 2014 +0200
+++ b/mercurial/changegroup.py Fri Oct 17 14:41:21 2014 +0200
@@ -523,14 +523,15 @@
bundler = cg1packer(repo)
return getsubset(repo, outgoing, bundler, source)
-def getlocalchangegroupraw(repo, source, outgoing, bundlecaps=None):
+def getlocalchangegroupraw(repo, source, outgoing, bundlecaps=None,
+ version=None):
"""Like getbundle, but taking a discovery.outgoing as an argument.
This is only implemented for local repos and reuses potentially
precomputed sets in outgoing. Returns a raw changegroup generator."""
if not outgoing.missing:
return None
- bundler = cg1packer(repo, bundlecaps)
+ bundler = packermap[version or '1'][0](repo, bundlecaps)
return getsubsetraw(repo, outgoing, bundler, source)
def getlocalchangegroup(repo, source, outgoing, bundlecaps=None):
@@ -562,17 +563,21 @@
heads = cl.heads()
return discovery.outgoing(cl, common, heads)
-def getchangegroupraw(repo, source, heads=None, common=None, bundlecaps=None):
+def getchangegroupraw(repo, source, heads=None, common=None, bundlecaps=None,
+ version=None):
"""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].
+ If version is None, use a version '1' changegroup.
+
The nodes in common might not all be known locally due to the way the
current discovery protocol works. Returns a raw changegroup generator.
"""
outgoing = _computeoutgoing(repo, heads, common)
- return getlocalchangegroupraw(repo, source, outgoing, bundlecaps=bundlecaps)
+ return getlocalchangegroupraw(repo, source, outgoing, bundlecaps=bundlecaps,
+ version=version)
def getchangegroup(repo, source, heads=None, common=None, bundlecaps=None):
"""Like changegroupsubset, but returns the set difference between the
diff -r 958fbc8c90b8 -r 7b3ef1e1d1d4 mercurial/exchange.py
--- a/mercurial/exchange.py Fri Oct 17 14:41:11 2014 +0200
+++ b/mercurial/exchange.py Fri Oct 17 14:41:21 2014 +0200
@@ -1172,11 +1172,14 @@
cg = None
if kwargs.get('cg', True):
# build changegroup bundle here.
+ version = '1'
cg = changegroup.getchangegroupraw(repo, source, heads=heads,
- common=common, bundlecaps=bundlecaps)
+ common=common, bundlecaps=bundlecaps,
+ version=version)
if cg:
- bundler.newpart('b2x:changegroup', data=cg)
+ part = bundler.newpart('b2x:changegroup', data=cg)
+ part.addparam('version', version)
@getbundle2partsgenerator('listkeys')
def _getbundlelistkeysparts(bundler, repo, source, bundlecaps=None,
More information about the Mercurial-devel
mailing list