Patchwork [1,of,7] changegroup: deduplicate 'getlocalchangegroup'

login
register
mail settings
Submitter Pierre-Yves David
Date May 5, 2017, 6:26 a.m.
Message ID <e27efdd66b0671a5a4c6.1493965611@nodosa.octopoid.net>
Download mbox | patch
Permalink /patch/20453/
State Accepted
Headers show

Comments

Pierre-Yves David - May 5, 2017, 6:26 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1493894205 -7200
#      Thu May 04 12:36:45 2017 +0200
# Node ID e27efdd66b0671a5a4c6facdbab52f05ad780f1f
# Parent  4d504e541d3d1a139f8ebbf8c405291140fd1853
# EXP-Topic changegroup.cleanup
# Available At https://www.mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull https://www.mercurial-scm.org/repo/users/marmoute/mercurial/ -r e27efdd66b06
changegroup: deduplicate 'getlocalchangegroup'

The two functions 'getlocalchangegroup' and 'getchangegroup' have been strictly
identical for multiple years ('getchangegroup' had a deprecated docstring)

We'll drop one of them (getlocalchangegroup, since it has the longest name).
However, we needs to migrate all users of the dropped one to the new one before
we can deprecate it. In the mean time we drop one of the duplicated definition
and the outdated docstring.

Patch

diff --git a/mercurial/changegroup.py b/mercurial/changegroup.py
--- a/mercurial/changegroup.py
+++ b/mercurial/changegroup.py
@@ -966,7 +966,7 @@  def getlocalchangegroupraw(repo, source,
     bundler = getbundler(version, repo)
     return getsubsetraw(repo, outgoing, bundler, source)
 
-def getlocalchangegroup(repo, source, outgoing, version='01'):
+def getchangegroup(repo, source, outgoing, version='01'):
     """Like getbundle, but taking a discovery.outgoing as an argument.
 
     This is only implemented for local repos and reuses potentially
@@ -976,16 +976,8 @@  def getlocalchangegroup(repo, source, ou
     bundler = getbundler(version, repo)
     return getsubset(repo, outgoing, bundler, source)
 
-def getchangegroup(repo, source, outgoing, 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.
-    """
-    return getlocalchangegroup(repo, source, outgoing, version=version)
+# deprecate me once all users are gone
+getlocalchangegroup = getchangegroup
 
 def changegroup(repo, basenodes, source):
     # to avoid a race we use changegroupsubset() (issue1320)