Mercurial > public > mercurial-scm > hg
comparison mercurial/changegroup.py @ 32164:29e286fa4db0
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.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Thu, 04 May 2017 12:36:45 +0200 |
parents | 282b288aa20c |
children | 4e6aab69a98b |
comparison
equal
deleted
inserted
replaced
32163:e1d1f1bc4a95 | 32164:29e286fa4db0 |
---|---|
964 if not outgoing.missing: | 964 if not outgoing.missing: |
965 return None | 965 return None |
966 bundler = getbundler(version, repo) | 966 bundler = getbundler(version, repo) |
967 return getsubsetraw(repo, outgoing, bundler, source) | 967 return getsubsetraw(repo, outgoing, bundler, source) |
968 | 968 |
969 def getlocalchangegroup(repo, source, outgoing, version='01'): | 969 def getchangegroup(repo, source, outgoing, version='01'): |
970 """Like getbundle, but taking a discovery.outgoing as an argument. | 970 """Like getbundle, but taking a discovery.outgoing as an argument. |
971 | 971 |
972 This is only implemented for local repos and reuses potentially | 972 This is only implemented for local repos and reuses potentially |
973 precomputed sets in outgoing.""" | 973 precomputed sets in outgoing.""" |
974 if not outgoing.missing: | 974 if not outgoing.missing: |
975 return None | 975 return None |
976 bundler = getbundler(version, repo) | 976 bundler = getbundler(version, repo) |
977 return getsubset(repo, outgoing, bundler, source) | 977 return getsubset(repo, outgoing, bundler, source) |
978 | 978 |
979 def getchangegroup(repo, source, outgoing, version='01'): | 979 # deprecate me once all users are gone |
980 """Like changegroupsubset, but returns the set difference between the | 980 getlocalchangegroup = getchangegroup |
981 ancestors of heads and the ancestors common. | |
982 | |
983 If heads is None, use the local heads. If common is None, use [nullid]. | |
984 | |
985 The nodes in common might not all be known locally due to the way the | |
986 current discovery protocol works. | |
987 """ | |
988 return getlocalchangegroup(repo, source, outgoing, version=version) | |
989 | 981 |
990 def changegroup(repo, basenodes, source): | 982 def changegroup(repo, basenodes, source): |
991 # to avoid a race we use changegroupsubset() (issue1320) | 983 # to avoid a race we use changegroupsubset() (issue1320) |
992 return changegroupsubset(repo, basenodes, repo.heads(), source) | 984 return changegroupsubset(repo, basenodes, repo.heads(), source) |
993 | 985 |