##// END OF EJS Templates
getchangegroup: take an 'outgoing' object as argument (API)...
Pierre-Yves David -
r29807:d4e02634 default
parent child Browse files
Show More
@@ -987,7 +987,7 b' def computeoutgoing(repo, heads, common)'
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.
@@ -997,7 +997,6 b' def getchangegroup(repo, source, heads=N'
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
@@ -1412,9 +1412,10 b' def bundle(ui, repo, fname, dest=None, *'
1412 "a destination"))
1412 "a destination"))
1413 common = [repo.lookup(rev) for rev in base]
1413 common = [repo.lookup(rev) for rev in base]
1414 heads = revs and map(repo.lookup, revs) or revs
1414 heads = revs and map(repo.lookup, revs) or revs
1415 cg = changegroup.getchangegroup(repo, 'bundle', heads=heads,
1415 outgoing = discovery.outgoing(repo, common, heads)
1416 common=common, bundlecaps=bundlecaps,
1416 cg = changegroup.getchangegroup(repo, 'bundle', outgoing,
1417 version=cgversion)
1417 bundlecaps=bundlecaps,
1418 version=cgversion)
1418 outgoing = None
1419 outgoing = None
1419 else:
1420 else:
1420 dest = ui.expandpath(dest or 'default-push', dest or 'default')
1421 dest = ui.expandpath(dest or 'default-push', dest or 'default')
@@ -1536,8 +1536,9 b' def getbundle(repo, source, heads=None, '
1536 if kwargs:
1536 if kwargs:
1537 raise ValueError(_('unsupported getbundle arguments: %s')
1537 raise ValueError(_('unsupported getbundle arguments: %s')
1538 % ', '.join(sorted(kwargs.keys())))
1538 % ', '.join(sorted(kwargs.keys())))
1539 return changegroup.getchangegroup(repo, source, heads=heads,
1539 outgoing = changegroup.computeoutgoing(repo, heads, common)
1540 common=common, bundlecaps=bundlecaps)
1540 return changegroup.getchangegroup(repo, source, outgoing,
1541 bundlecaps=bundlecaps)
1541
1542
1542 # bundle20 case
1543 # bundle20 case
1543 b2caps = {}
1544 b2caps = {}
@@ -3,7 +3,7 b' Create an extension to test bundle2 with'
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,
@@ -12,13 +12,14 b' Create an extension to test bundle2 with'
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 >
@@ -8,7 +8,7 b' Create an extension to test bundle2 remo'
8 > Current bundle2 implementation doesn't provide a way to generate those
8 > Current bundle2 implementation doesn't provide a way to generate those
9 > parts, so they must be created by extensions.
9 > parts, so they must be created by extensions.
10 > """
10 > """
11 > from mercurial import bundle2, changegroup, exchange, util
11 > from mercurial import bundle2, changegroup, discovery, exchange, util
12 >
12 >
13 > def _getbundlechangegrouppart(bundler, repo, source, bundlecaps=None,
13 > def _getbundlechangegrouppart(bundler, repo, source, bundlecaps=None,
14 > b2caps=None, heads=None, common=None,
14 > b2caps=None, heads=None, common=None,
@@ -22,7 +22,7 b' Create an extension to test bundle2 remo'
22 > part to add:
22 > part to add:
23 > - changegroup common_revset heads_revset
23 > - changegroup common_revset heads_revset
24 > Creates a changegroup part based, using common_revset and
24 > Creates a changegroup part based, using common_revset and
25 > heads_revset for changegroup.getchangegroup.
25 > heads_revset for outgoing
26 > - remote-changegroup url file
26 > - remote-changegroup url file
27 > Creates a remote-changegroup part for a bundle at the given
27 > Creates a remote-changegroup part for a bundle at the given
28 > url. Size and digest, as required by the client, are computed
28 > url. Size and digest, as required by the client, are computed
@@ -63,8 +63,8 b' Create an extension to test bundle2 remo'
63 > _common, heads = args.split()
63 > _common, heads = args.split()
64 > common.extend(repo.lookup(r) for r in repo.revs(_common))
64 > common.extend(repo.lookup(r) for r in repo.revs(_common))
65 > heads = [repo.lookup(r) for r in repo.revs(heads)]
65 > heads = [repo.lookup(r) for r in repo.revs(heads)]
66 > cg = changegroup.getchangegroup(repo, 'changegroup',
66 > outgoing = discovery.outgoing(repo, common, heads)
67 > heads=heads, common=common)
67 > cg = changegroup.getchangegroup(repo, 'changegroup', outgoing)
68 > newpart('changegroup', cg.getchunks())
68 > newpart('changegroup', cg.getchunks())
69 > else:
69 > else:
70 > raise Exception('unknown verb')
70 > raise Exception('unknown verb')
General Comments 0
You need to be logged in to leave comments. Login now