comparison mercurial/changegroup.py @ 29807:d4e026341e16

getchangegroup: take an 'outgoing' object as argument (API) There is various version of this function that differ mostly by the way they define the bundled set. The flexibility is now available in the outgoing object itself so we move the complexity into the caller themself. This will allow use to remove a good share of the similar function to obtains a changegroup in the 'changegroup.py' module. An important side effect is that we stop calling 'computeoutgoing' in 'getchangegroup'. This is fine as code that needs such argument processing is actually going through the 'exchange' module which already all this function itself.
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Tue, 09 Aug 2016 17:00:38 +0200
parents 82e8c86cdd6d
children 8d226db31f20
comparison
equal deleted inserted replaced
29806:82e8c86cdd6d 29807:d4e026341e16
985 common = [nullid] 985 common = [nullid]
986 if not heads: 986 if not heads:
987 heads = cl.heads() 987 heads = cl.heads()
988 return discovery.outgoing(repo, common, heads) 988 return discovery.outgoing(repo, common, heads)
989 989
990 def getchangegroup(repo, source, heads=None, common=None, bundlecaps=None, 990 def getchangegroup(repo, source, outgoing, bundlecaps=None,
991 version='01'): 991 version='01'):
992 """Like changegroupsubset, but returns the set difference between the 992 """Like changegroupsubset, but returns the set difference between the
993 ancestors of heads and the ancestors common. 993 ancestors of heads and the ancestors common.
994 994
995 If heads is None, use the local heads. If common is None, use [nullid]. 995 If heads is None, use the local heads. If common is None, use [nullid].
996 996
997 The nodes in common might not all be known locally due to the way the 997 The nodes in common might not all be known locally due to the way the
998 current discovery protocol works. 998 current discovery protocol works.
999 """ 999 """
1000 outgoing = computeoutgoing(repo, heads, common)
1001 return getlocalchangegroup(repo, source, outgoing, bundlecaps=bundlecaps, 1000 return getlocalchangegroup(repo, source, outgoing, bundlecaps=bundlecaps,
1002 version=version) 1001 version=version)
1003 1002
1004 def changegroup(repo, basenodes, source): 1003 def changegroup(repo, basenodes, source):
1005 # to avoid a race we use changegroupsubset() (issue1320) 1004 # to avoid a race we use changegroupsubset() (issue1320)