Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 10010:2fce96916d97
changegroupsubset: simplify parents pruning
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Fri, 04 Dec 2009 17:42:59 +0100 |
parents | 7bcbdefcd93a |
children | a9836feb5a8c |
comparison
equal
deleted
inserted
replaced
10009:69dca8574a6a | 10010:2fce96916d97 |
---|---|
1705 # If we determine that a particular file or manifest node must be a | 1705 # If we determine that a particular file or manifest node must be a |
1706 # node that the recipient of the changegroup will already have, we can | 1706 # node that the recipient of the changegroup will already have, we can |
1707 # also assume the recipient will have all the parents. This function | 1707 # also assume the recipient will have all the parents. This function |
1708 # prunes them from the set of missing nodes. | 1708 # prunes them from the set of missing nodes. |
1709 def prune_parents(revlog, hasset, msngset): | 1709 def prune_parents(revlog, hasset, msngset): |
1710 haslst = list(hasset) | 1710 for r in revlog.ancestors(*[revlog.rev(n) for n in hasset]): |
1711 haslst.sort(key=revlog.rev) | 1711 msngset.pop(revlog.node(r), None) |
1712 for node in haslst: | |
1713 parentlst = [p for p in revlog.parents(node) if p != nullid] | |
1714 while parentlst: | |
1715 n = parentlst.pop() | |
1716 if n not in hasset: | |
1717 hasset.add(n) | |
1718 p = [p for p in revlog.parents(n) if p != nullid] | |
1719 parentlst.extend(p) | |
1720 for n in hasset: | |
1721 msngset.pop(n, None) | |
1722 | 1712 |
1723 # This is a function generating function used to set up an environment | 1713 # This is a function generating function used to set up an environment |
1724 # for the inner function to execute in. | 1714 # for the inner function to execute in. |
1725 def manifest_and_file_collector(changedfileset): | 1715 def manifest_and_file_collector(changedfileset): |
1726 # This is an information gathering function that gathers | 1716 # This is an information gathering function that gathers |