Mercurial > public > mercurial-scm > hg
comparison mercurial/changegroup.py @ 20930:4a987060d97e
localrepo: move the getbundle method in changegroup module
This is a gratuitous code move aimed at reducing the localrepo bloatness.
The method had few callers, not enough to be kept in local repo.
The peer API remains unchanged.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Tue, 01 Apr 2014 14:40:35 -0700 |
parents | 91b47139d0cb |
children | de60ca3a390e |
comparison
equal
deleted
inserted
replaced
20929:afe0b48ef2d7 | 20930:4a987060d97e |
---|---|
488 if not outgoing.missing: | 488 if not outgoing.missing: |
489 return None | 489 return None |
490 bundler = bundle10(repo, bundlecaps) | 490 bundler = bundle10(repo, bundlecaps) |
491 return getsubset(repo, outgoing, bundler, source) | 491 return getsubset(repo, outgoing, bundler, source) |
492 | 492 |
493 def getbundle(repo, source, heads=None, common=None, bundlecaps=None): | |
494 """Like changegroupsubset, but returns the set difference between the | |
495 ancestors of heads and the ancestors common. | |
496 | |
497 If heads is None, use the local heads. If common is None, use [nullid]. | |
498 | |
499 The nodes in common might not all be known locally due to the way the | |
500 current discovery protocol works. | |
501 """ | |
502 cl = repo.changelog | |
503 if common: | |
504 hasnode = cl.hasnode | |
505 common = [n for n in common if hasnode(n)] | |
506 else: | |
507 common = [nullid] | |
508 if not heads: | |
509 heads = cl.heads() | |
510 outgoing = discovery.outgoing(cl, common, heads) | |
511 return getlocalbundle(repo, source, outgoing, bundlecaps=bundlecaps) | |
512 |