[PATCH 4 of 6] changegroup: expose list of changesets from getlocalchangegroup
Gregory Szorc
gregory.szorc at gmail.com
Tue May 26 00:42:37 UTC 2015
# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1432590935 25200
# Mon May 25 14:55:35 2015 -0700
# Node ID c152c1659c8f4afa36a34437f4b7a06e41cdb77f
# Parent 40916b298b6a2106814992935565f61a6d3a7e2c
changegroup: expose list of changesets from getlocalchangegroup
This isn't needed for the overall series. However, making this change
ensures API parity with getlocalchangegroupraw, which seems like a good
idea.
diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -616,13 +616,17 @@ def getlocalchangegroupraw(repo, source,
def getlocalchangegroup(repo, source, outgoing, bundlecaps=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."""
+ precomputed sets in outgoing.
+
+ Returns a list of binary changeset nodes and a raw changegroup iterator.
+ Both values may be None if there are no missing changesets.
+ """
if not outgoing.missing:
- return None
+ return None, None
bundler = cg1packer(repo, bundlecaps)
- return getsubset(repo, outgoing, bundler, source)[1]
+ return getsubset(repo, outgoing, bundler, source)
def _computeoutgoing(repo, heads, common):
"""Computes which revs are outgoing given a set of common
and a set of heads.
@@ -667,9 +671,9 @@ def getchangegroup(repo, source, heads=N
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)[1]
def changegroup(repo, basenodes, source):
# to avoid a race we use changegroupsubset() (issue1320)
return changegroupsubset(repo, basenodes, repo.heads(), source)
diff --git a/mercurial/commands.py b/mercurial/commands.py
--- a/mercurial/commands.py
+++ b/mercurial/commands.py
@@ -1248,9 +1248,9 @@ def bundle(ui, repo, fname, dest=None, *
onlyheads=heads,
force=opts.get('force'),
portable=True)
cg = changegroup.getlocalchangegroup(repo, 'bundle', outgoing,
- bundlecaps)
+ bundlecaps)[1]
if not cg:
scmutil.nochangesfound(ui, repo, outgoing and outgoing.excluded)
return 1
diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -646,10 +646,10 @@ def _pushchangeset(pushop):
bundler,
'push',
fastpath=True)[1]
else:
- cg = changegroup.getlocalchangegroup(pushop.repo, 'push', outgoing,
- bundlecaps)
+ cg = changegroup.getlocalchangegroup(pushop.repo, 'push',
+ outgoing, bundlecaps)[1]
# apply changegroup to remote
if unbundle:
# local repo finds heads on server, finds out what
diff --git a/tests/test-bundle2-format.t b/tests/test-bundle2-format.t
--- a/tests/test-bundle2-format.t
+++ b/tests/test-bundle2-format.t
@@ -107,9 +107,9 @@ Create an extension to test bundle2 API
> bundled = repo.revs('%ld::%ld', revs, revs)
> headmissing = [c.node() for c in repo.set('heads(%ld)', revs)]
> headcommon = [c.node() for c in repo.set('parents(%ld) - %ld', revs, revs)]
> outgoing = discovery.outgoing(repo.changelog, headcommon, headmissing)
- > cg = changegroup.getlocalchangegroup(repo, 'test:bundle2', outgoing, None)
+ > cg = changegroup.getlocalchangegroup(repo, 'test:bundle2', outgoing, None)[1]
> bundler.newpart('changegroup', data=cg.getchunks(),
> mandatory=False)
>
> if opts['parts']:
More information about the Mercurial-devel
mailing list