##// END OF EJS Templates
changegroup: introduce "raw" versions of some commands...
Sune Foldager -
r23177:706547a1 default
parent child Browse files
Show More
@@ -443,7 +443,7 b' def _changegroupinfo(repo, nodes, source'
443 443 for node in nodes:
444 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 447 repo = repo.unfiltered()
448 448 commonrevs = outgoing.common
449 449 csets = outgoing.missing
@@ -457,7 +457,10 b' def getsubset(repo, outgoing, bundler, s'
457 457
458 458 repo.hook('preoutgoing', throw=True, source=source)
459 459 _changegroupinfo(repo, csets, source)
460 gengroup = bundler.generate(commonrevs, csets, fastpathlinkrev, source)
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 464 return cg1unpacker(util.chunkbuffer(gengroup), 'UN')
462 465
463 466 def changegroupsubset(repo, roots, heads, source):
@@ -485,6 +488,16 b' def changegroupsubset(repo, roots, heads'
485 488 bundler = cg1packer(repo)
486 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 501 def getlocalchangegroup(repo, source, outgoing, bundlecaps=None):
489 502 """Like getbundle, but taking a discovery.outgoing as an argument.
490 503
@@ -514,6 +527,18 b' def _computeoutgoing(repo, heads, common'
514 527 heads = cl.heads()
515 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 542 def getchangegroup(repo, source, heads=None, common=None, bundlecaps=None):
518 543 """Like changegroupsubset, but returns the set difference between the
519 544 ancestors of heads and the ancestors common.
@@ -445,8 +445,9 b' def _pushb2ctx(pushop, bundler):'
445 445 pushop.outgoing)
446 446 if not pushop.force:
447 447 bundler.newpart('B2X:CHECK:HEADS', data=iter(pushop.remoteheads))
448 cg = changegroup.getlocalchangegroup(pushop.repo, 'push', pushop.outgoing)
449 cgpart = bundler.newpart('B2X:CHANGEGROUP', data=cg.getchunks())
448 cg = changegroup.getlocalchangegroupraw(pushop.repo, 'push',
449 pushop.outgoing)
450 cgpart = bundler.newpart('B2X:CHANGEGROUP', data=cg)
450 451 def handlereply(op):
451 452 """extract addchangegroup returns from server reply"""
452 453 cgreplies = op.records.getreplies(cgpart.id)
@@ -1185,11 +1186,11 b' def _getbundlechangegrouppart(bundler, r'
1185 1186 cg = None
1186 1187 if kwargs.get('cg', True):
1187 1188 # build changegroup bundle here.
1188 cg = changegroup.getchangegroup(repo, source, heads=heads,
1189 cg = changegroup.getchangegroupraw(repo, source, heads=heads,
1189 1190 common=common, bundlecaps=bundlecaps)
1190 1191
1191 1192 if cg:
1192 bundler.newpart('b2x:changegroup', data=cg.getchunks())
1193 bundler.newpart('b2x:changegroup', data=cg)
1193 1194
1194 1195 @getbundle2partsgenerator('listkeys')
1195 1196 def _getbundlelistkeysparts(bundler, repo, source, bundlecaps=None,
General Comments 0
You need to be logged in to leave comments. Login now