##// END OF EJS Templates
changegroup: refactor outgoing logic into a function...
Durham Goode -
r21260:aa3e5660 default
parent child Browse files
Show More
@@ -493,6 +493,25 b' def getlocalbundle(repo, source, outgoin'
493 493 bundler = bundle10(repo, bundlecaps)
494 494 return getsubset(repo, outgoing, bundler, source)
495 495
496 def _computeoutgoing(repo, heads, common):
497 """Computes which revs are outgoing given a set of common
498 and a set of heads.
499
500 This is a separate function so extensions can have access to
501 the logic.
502
503 Returns a discovery.outgoing object.
504 """
505 cl = repo.changelog
506 if common:
507 hasnode = cl.hasnode
508 common = [n for n in common if hasnode(n)]
509 else:
510 common = [nullid]
511 if not heads:
512 heads = cl.heads()
513 return discovery.outgoing(cl, common, heads)
514
496 515 def getbundle(repo, source, heads=None, common=None, bundlecaps=None):
497 516 """Like changegroupsubset, but returns the set difference between the
498 517 ancestors of heads and the ancestors common.
@@ -502,15 +521,7 b' def getbundle(repo, source, heads=None, '
502 521 The nodes in common might not all be known locally due to the way the
503 522 current discovery protocol works.
504 523 """
505 cl = repo.changelog
506 if common:
507 hasnode = cl.hasnode
508 common = [n for n in common if hasnode(n)]
509 else:
510 common = [nullid]
511 if not heads:
512 heads = cl.heads()
513 outgoing = discovery.outgoing(cl, common, heads)
524 outgoing = _computeoutgoing(repo, heads, common)
514 525 return getlocalbundle(repo, source, outgoing, bundlecaps=bundlecaps)
515 526
516 527 def changegroup(repo, basenodes, source):
General Comments 0
You need to be logged in to leave comments. Login now