# HG changeset patch # User Benoit Boissinot # Date 2010-07-22 22:04:18 # Node ID a3bfdf21209432b45e37f22912fa003adffb77e0 # Parent b16fb5d55b8382b45d0d48d5d0ad052d6549bb3f changegroupsubset: simplify knownheads/has_cl_set computation diff --git a/mercurial/localrepo.py b/mercurial/localrepo.py --- a/mercurial/localrepo.py +++ b/mercurial/localrepo.py @@ -1305,26 +1305,8 @@ class localrepository(repo.repository): self.changegroupinfo(msng_cl_lst, source) - # Known heads are the list of heads that it is assumed the recipient - # of this changegroup will know about. - knownheads = set() - # We assume that all parents of bases are known heads. - for n in bases: - knownheads.update(cl.parents(n)) - knownheads.discard(nullid) - if knownheads: - # Now that we know what heads are known, we can compute which - # changesets are known. The recipient must know about all - # changesets required to reach the known heads from the null - # changeset. - has_cl_set, junk, junk = cl.nodesbetween(None, knownheads) - junk = None - # Transform the list into a set. - has_cl_set = set(has_cl_set) - else: - # If there were no known heads, the recipient cannot be assumed to - # know about any changesets. - has_cl_set = set() + # We assume that all ancestors of bases are known + commonrevs = set(cl.ancestors(*[cl.rev(n) for n in bases])) # Make it easy to refer to self.manifest mnfst = self.manifest @@ -1395,8 +1377,8 @@ class localrepository(repo.repository): # assume the recipient must have, then the recipient must have # that filenode. for n in missingnodes: - clnode = cl.node(revlog.linkrev(revlog.rev(n))) - if clnode in has_cl_set: + clrev = revlog.linkrev(revlog.rev(n)) + if clrev in commonrevs: hasset.add(n) for n in hasset: missingnodes.pop(n, None)