[PATCH 6 of 6] changegroup: expose list of changesets from getchangegroup

Gregory Szorc gregory.szorc at gmail.com
Mon May 25 19:42:39 CDT 2015


# HG changeset patch
# User Gregory Szorc <gregory.szorc at gmail.com>
# Date 1432592621 25200
#      Mon May 25 15:23:41 2015 -0700
# Node ID 419579a1fc7ca79c4986b500d7f05ee3a84c0cd5
# Parent  eec32b6c4b3c3b45250f78918eb3cfde17be7da5
changegroup: expose list of changesets from getchangegroup

This isn't required for the end goal of this series, but it does
establish API parity between the raw and non-raw functions.

diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -672,11 +672,14 @@ def getchangegroup(repo, source, heads=N
     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.
+
+    Returns a list of binary changeset nodes and an iterator over raw
+    changegroup data.
     """
     outgoing = _computeoutgoing(repo, heads, common)
-    return getlocalchangegroup(repo, source, outgoing, bundlecaps=bundlecaps)[1]
+    return getlocalchangegroup(repo, source, outgoing, bundlecaps=bundlecaps)
 
 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
@@ -1235,9 +1235,10 @@ def bundle(ui, repo, fname, dest=None, *
                                "a destination"))
         common = [repo.lookup(rev) for rev in base]
         heads = revs and map(repo.lookup, revs) or revs
         cg = changegroup.getchangegroup(repo, 'bundle', heads=heads,
-                                         common=common, bundlecaps=bundlecaps)
+                                        common=common,
+                                        bundlecaps=bundlecaps)[1]
         outgoing = None
     else:
         dest = ui.expandpath(dest or 'default-push', dest or 'default')
         dest, branches = hg.parseurl(dest, opts.get('branch'))
diff --git a/mercurial/exchange.py b/mercurial/exchange.py
--- a/mercurial/exchange.py
+++ b/mercurial/exchange.py
@@ -1190,9 +1190,10 @@ def getbundle(repo, source, heads=None, 
         if kwargs:
             raise ValueError(_('unsupported getbundle arguments: %s')
                              % ', '.join(sorted(kwargs.keys())))
         return changegroup.getchangegroup(repo, source, heads=heads,
-                                          common=common, bundlecaps=bundlecaps)
+                                          common=common,
+                                          bundlecaps=bundlecaps)[1]
 
     # bundle20 case
     b2caps = {}
     for bcaps in bundlecaps:
diff --git a/tests/test-bundle2-multiple-changegroups.t b/tests/test-bundle2-multiple-changegroups.t
--- a/tests/test-bundle2-multiple-changegroups.t
+++ b/tests/test-bundle2-multiple-changegroups.t
@@ -12,14 +12,14 @@ Create an extension to test bundle2 with
   >     # changegroup part we are being requested. Use the parent of each head
   >     # in 'heads' as intermediate heads for the first changegroup.
   >     intermediates = [repo[r].p1().node() for r in heads]
   >     cg = changegroup.getchangegroup(repo, source, heads=intermediates,
-  >                                      common=common, bundlecaps=bundlecaps)
+  >                                      common=common, bundlecaps=bundlecaps)[1]
   >     bundler.newpart('output', data='changegroup1')
   >     bundler.newpart('changegroup', data=cg.getchunks())
   >     cg = changegroup.getchangegroup(repo, source, heads=heads,
   >                                      common=common + intermediates,
-  >                                      bundlecaps=bundlecaps)
+  >                                      bundlecaps=bundlecaps)[1]
   >     bundler.newpart('output', data='changegroup2')
   >     bundler.newpart('changegroup', data=cg.getchunks())
   > 
   > def _pull(repo, *args, **kwargs):
diff --git a/tests/test-bundle2-remote-changegroup.t b/tests/test-bundle2-remote-changegroup.t
--- a/tests/test-bundle2-remote-changegroup.t
+++ b/tests/test-bundle2-remote-changegroup.t
@@ -63,9 +63,9 @@ Create an extension to test bundle2 remo
   >             _common, heads = args.split()
   >             common.extend(repo.lookup(r) for r in repo.revs(_common))
   >             heads = [repo.lookup(r) for r in repo.revs(heads)]
   >             cg = changegroup.getchangegroup(repo, 'changegroup',
-  >                 heads=heads, common=common)
+  >                 heads=heads, common=common)[1]
   >             newpart('changegroup', cg.getchunks())
   >         else:
   >             raise Exception('unknown verb')
   > 


More information about the Mercurial-devel mailing list