Patchwork [8,of,9,changegroup-apis] changegroup: implement getchangegroup using changegroupemitter

login
register
mail settings
Submitter Gregory Szorc
Date Aug. 1, 2016, 6:18 p.m.
Message ID <bce10af41c89e164e5d7.1470075505@ubuntu-vm-main>
Download mbox | patch
Permalink /patch/16021/
State Changes Requested
Delegated to: Pierre-Yves David
Headers show

Comments

Gregory Szorc - Aug. 1, 2016, 6:18 p.m.
# HG changeset patch
# User Gregory Szorc <gregory.szorc@gmail.com>
# Date 1469909230 25200
#      Sat Jul 30 13:07:10 2016 -0700
# Node ID bce10af41c89e164e5d74fabeb518fc9174205f9
# Parent  707393be6c674cded25255e4fa19d9b791b56f46
changegroup: implement getchangegroup using changegroupemitter

This gets rid of one consumer of getlocalchangegroup(), which
isn't used frequently. It also demonstrates how similar and
redundant all these low-level functions actually are.

Patch

diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -969,19 +969,18 @@  def getchangegroup(repo, source, heads=N
     """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,
-                               version=version)
+    emitter = changegroupemitter.fromheadsandcommon(repo, heads, common)
+    return emitter.getunbundler(version, source, bundlecaps=bundlecaps)
 
 def changegroup(repo, basenodes, source):
     # to avoid a race we use changegroupsubset() (issue1320)
     return changegroupsubset(repo, basenodes, repo.heads(), source)
 
 def _addchangegroupfiles(repo, source, revmap, trp, expectedfiles, needfiles):
     revisions = 0
     files = 0