Mercurial > public > mercurial-scm > hg-stable
diff mercurial/localrepo.py @ 15837:cd956049fc14
discovery: introduce outgoing object for result of findcommonoutgoing
Simplifies client logic in multiple places since it encapsulates the
computation of the common and, more importantly, the missing node lists.
This also allows an upcomping patch to communicate precomputed versions of
these lists to clients.
author | Pierre-Yves David <pierre-yves.david@ens-lyon.org> |
---|---|
date | Mon, 09 Jan 2012 03:47:16 +0100 |
parents | 2673006f7989 |
children | cc8287d51680 |
line wrap: on
line diff
--- a/mercurial/localrepo.py Mon Jan 09 04:16:00 2012 +0100 +++ b/mercurial/localrepo.py Mon Jan 09 03:47:16 2012 +0100 @@ -1739,6 +1739,18 @@ common = set(cl.ancestors(*[cl.rev(n) for n in bases])) return self._changegroupsubset(common, csets, heads, source) + def getlocalbundle(self, source, outgoing): + """Like getbundle, but taking a discovery.outgoing as an argument. + + This is only implemented for local repos and reuses potentially + precomputed sets in outgoing.""" + if not outgoing.missing: + return None + return self._changegroupsubset(outgoing.common, + outgoing.missing, + outgoing.missingheads, + source) + def getbundle(self, source, heads=None, common=None): """Like changegroupsubset, but returns the set difference between the ancestors of heads and the ancestors common. @@ -1756,10 +1768,8 @@ common = [nullid] if not heads: heads = cl.heads() - common, missing = cl.findcommonmissing(common, heads) - if not missing: - return None - return self._changegroupsubset(common, missing, heads, source) + return self.getlocalbundle(source, + discovery.outgoing(cl, common, heads)) def _changegroupsubset(self, commonrevs, csets, heads, source):