Show More
@@ -443,7 +443,7 b' def _changegroupinfo(repo, nodes, source' | |||||
443 | for node in nodes: |
|
443 | for node in nodes: | |
444 | repo.ui.debug("%s\n" % hex(node)) |
|
444 | repo.ui.debug("%s\n" % hex(node)) | |
445 |
|
445 | |||
446 | def getsubset(repo, outgoing, bundler, source, fastpath=False): |
|
446 | def getsubsetraw(repo, outgoing, bundler, source, fastpath=False): | |
447 | repo = repo.unfiltered() |
|
447 | repo = repo.unfiltered() | |
448 | commonrevs = outgoing.common |
|
448 | commonrevs = outgoing.common | |
449 | csets = outgoing.missing |
|
449 | csets = outgoing.missing | |
@@ -457,7 +457,10 b' def getsubset(repo, outgoing, bundler, s' | |||||
457 |
|
457 | |||
458 | repo.hook('preoutgoing', throw=True, source=source) |
|
458 | repo.hook('preoutgoing', throw=True, source=source) | |
459 | _changegroupinfo(repo, csets, source) |
|
459 | _changegroupinfo(repo, csets, source) | |
460 |
|
|
460 | return bundler.generate(commonrevs, csets, fastpathlinkrev, source) | |
|
461 | ||||
|
462 | def getsubset(repo, outgoing, bundler, source, fastpath=False): | |||
|
463 | gengroup = getsubsetraw(repo, outgoing, bundler, source, fastpath) | |||
461 | return cg1unpacker(util.chunkbuffer(gengroup), 'UN') |
|
464 | return cg1unpacker(util.chunkbuffer(gengroup), 'UN') | |
462 |
|
465 | |||
463 | def changegroupsubset(repo, roots, heads, source): |
|
466 | def changegroupsubset(repo, roots, heads, source): | |
@@ -485,6 +488,16 b' def changegroupsubset(repo, roots, heads' | |||||
485 | bundler = cg1packer(repo) |
|
488 | bundler = cg1packer(repo) | |
486 | return getsubset(repo, outgoing, bundler, source) |
|
489 | return getsubset(repo, outgoing, bundler, source) | |
487 |
|
490 | |||
|
491 | def getlocalchangegroupraw(repo, source, outgoing, bundlecaps=None): | |||
|
492 | """Like getbundle, but taking a discovery.outgoing as an argument. | |||
|
493 | ||||
|
494 | This is only implemented for local repos and reuses potentially | |||
|
495 | precomputed sets in outgoing. Returns a raw changegroup generator.""" | |||
|
496 | if not outgoing.missing: | |||
|
497 | return None | |||
|
498 | bundler = cg1packer(repo, bundlecaps) | |||
|
499 | return getsubsetraw(repo, outgoing, bundler, source) | |||
|
500 | ||||
488 | def getlocalchangegroup(repo, source, outgoing, bundlecaps=None): |
|
501 | def getlocalchangegroup(repo, source, outgoing, bundlecaps=None): | |
489 | """Like getbundle, but taking a discovery.outgoing as an argument. |
|
502 | """Like getbundle, but taking a discovery.outgoing as an argument. | |
490 |
|
503 | |||
@@ -514,6 +527,18 b' def _computeoutgoing(repo, heads, common' | |||||
514 | heads = cl.heads() |
|
527 | heads = cl.heads() | |
515 | return discovery.outgoing(cl, common, heads) |
|
528 | return discovery.outgoing(cl, common, heads) | |
516 |
|
529 | |||
|
530 | def getchangegroupraw(repo, source, heads=None, common=None, bundlecaps=None): | |||
|
531 | """Like changegroupsubset, but returns the set difference between the | |||
|
532 | ancestors of heads and the ancestors common. | |||
|
533 | ||||
|
534 | If heads is None, use the local heads. If common is None, use [nullid]. | |||
|
535 | ||||
|
536 | The nodes in common might not all be known locally due to the way the | |||
|
537 | current discovery protocol works. Returns a raw changegroup generator. | |||
|
538 | """ | |||
|
539 | outgoing = _computeoutgoing(repo, heads, common) | |||
|
540 | return getlocalchangegroupraw(repo, source, outgoing, bundlecaps=bundlecaps) | |||
|
541 | ||||
517 | def getchangegroup(repo, source, heads=None, common=None, bundlecaps=None): |
|
542 | def getchangegroup(repo, source, heads=None, common=None, bundlecaps=None): | |
518 | """Like changegroupsubset, but returns the set difference between the |
|
543 | """Like changegroupsubset, but returns the set difference between the | |
519 | ancestors of heads and the ancestors common. |
|
544 | ancestors of heads and the ancestors common. |
@@ -445,8 +445,9 b' def _pushb2ctx(pushop, bundler):' | |||||
445 | pushop.outgoing) |
|
445 | pushop.outgoing) | |
446 | if not pushop.force: |
|
446 | if not pushop.force: | |
447 | bundler.newpart('B2X:CHECK:HEADS', data=iter(pushop.remoteheads)) |
|
447 | bundler.newpart('B2X:CHECK:HEADS', data=iter(pushop.remoteheads)) | |
448 |
cg = changegroup.getlocalchangegroup(pushop.repo, 'push', |
|
448 | cg = changegroup.getlocalchangegroupraw(pushop.repo, 'push', | |
449 | cgpart = bundler.newpart('B2X:CHANGEGROUP', data=cg.getchunks()) |
|
449 | pushop.outgoing) | |
|
450 | cgpart = bundler.newpart('B2X:CHANGEGROUP', data=cg) | |||
450 | def handlereply(op): |
|
451 | def handlereply(op): | |
451 | """extract addchangegroup returns from server reply""" |
|
452 | """extract addchangegroup returns from server reply""" | |
452 | cgreplies = op.records.getreplies(cgpart.id) |
|
453 | cgreplies = op.records.getreplies(cgpart.id) | |
@@ -1185,11 +1186,11 b' def _getbundlechangegrouppart(bundler, r' | |||||
1185 | cg = None |
|
1186 | cg = None | |
1186 | if kwargs.get('cg', True): |
|
1187 | if kwargs.get('cg', True): | |
1187 | # build changegroup bundle here. |
|
1188 | # build changegroup bundle here. | |
1188 | cg = changegroup.getchangegroup(repo, source, heads=heads, |
|
1189 | cg = changegroup.getchangegroupraw(repo, source, heads=heads, | |
1189 | common=common, bundlecaps=bundlecaps) |
|
1190 | common=common, bundlecaps=bundlecaps) | |
1190 |
|
1191 | |||
1191 | if cg: |
|
1192 | if cg: | |
1192 |
bundler.newpart('b2x:changegroup', data=cg |
|
1193 | bundler.newpart('b2x:changegroup', data=cg) | |
1193 |
|
1194 | |||
1194 | @getbundle2partsgenerator('listkeys') |
|
1195 | @getbundle2partsgenerator('listkeys') | |
1195 | def _getbundlelistkeysparts(bundler, repo, source, bundlecaps=None, |
|
1196 | def _getbundlelistkeysparts(bundler, repo, source, bundlecaps=None, |
General Comments 0
You need to be logged in to leave comments.
Login now