comparison tests/test-bundle2-multiple-changegroups.t @ 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 622782ea9cf3
children 728d37353e1e
comparison
equal deleted inserted replaced
29806:82e8c86cdd6d 29807:d4e026341e16
1 Create an extension to test bundle2 with multiple changegroups 1 Create an extension to test bundle2 with multiple changegroups
2 2
3 $ cat > bundle2.py <<EOF 3 $ cat > bundle2.py <<EOF
4 > """ 4 > """
5 > """ 5 > """
6 > from mercurial import changegroup, exchange 6 > from mercurial import changegroup, discovery, exchange
7 > 7 >
8 > def _getbundlechangegrouppart(bundler, repo, source, bundlecaps=None, 8 > def _getbundlechangegrouppart(bundler, repo, source, bundlecaps=None,
9 > b2caps=None, heads=None, common=None, 9 > b2caps=None, heads=None, common=None,
10 > **kwargs): 10 > **kwargs):
11 > # Create two changegroups given the common changesets and heads for the 11 > # Create two changegroups given the common changesets and heads for the
12 > # changegroup part we are being requested. Use the parent of each head 12 > # changegroup part we are being requested. Use the parent of each head
13 > # in 'heads' as intermediate heads for the first changegroup. 13 > # in 'heads' as intermediate heads for the first changegroup.
14 > intermediates = [repo[r].p1().node() for r in heads] 14 > intermediates = [repo[r].p1().node() for r in heads]
15 > cg = changegroup.getchangegroup(repo, source, heads=intermediates, 15 > outgoing = discovery.outgoing(repo, common, intermediates)
16 > common=common, bundlecaps=bundlecaps) 16 > cg = changegroup.getchangegroup(repo, source, outgoing,
17 > bundlecaps=bundlecaps)
17 > bundler.newpart('output', data='changegroup1') 18 > bundler.newpart('output', data='changegroup1')
18 > bundler.newpart('changegroup', data=cg.getchunks()) 19 > bundler.newpart('changegroup', data=cg.getchunks())
19 > cg = changegroup.getchangegroup(repo, source, heads=heads, 20 > outgoing = discovery.outgoing(repo, common + intermediates, heads)
20 > common=common + intermediates, 21 > cg = changegroup.getchangegroup(repo, source, outgoing,
21 > bundlecaps=bundlecaps) 22 > bundlecaps=bundlecaps)
22 > bundler.newpart('output', data='changegroup2') 23 > bundler.newpart('output', data='changegroup2')
23 > bundler.newpart('changegroup', data=cg.getchunks()) 24 > bundler.newpart('changegroup', data=cg.getchunks())
24 > 25 >
25 > def _pull(repo, *args, **kwargs): 26 > def _pull(repo, *args, **kwargs):
26 > pullop = _orig_pull(repo, *args, **kwargs) 27 > pullop = _orig_pull(repo, *args, **kwargs)