Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/localrepo.py @ 13708:ce9b3043b79d
changegroupsubset: simplify prune
Ancestors of nodes linked to commonrevs can be expected to be linked
to commonrevs. Walking graphs of each revlog looking for rare/nonexistent outliers is overkill.
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Sun, 20 Mar 2011 19:43:28 -0500 |
parents | 296e78744d32 |
children | 53826e7a1d22 |
comparison
equal
deleted
inserted
replaced
13707:296e78744d32 | 13708:ce9b3043b79d |
---|---|
1506 # If we determine that a particular file or manifest node must be a | 1506 # If we determine that a particular file or manifest node must be a |
1507 # node that the recipient of the changegroup will already have, we can | 1507 # node that the recipient of the changegroup will already have, we can |
1508 # also assume the recipient will have all the parents. This function | 1508 # also assume the recipient will have all the parents. This function |
1509 # prunes them from the set of missing nodes. | 1509 # prunes them from the set of missing nodes. |
1510 def prune(revlog, missingnodes): | 1510 def prune(revlog, missingnodes): |
1511 hasset = set() | 1511 # drop any nodes that claim to be part of a cset in commonrevs |
1512 # If a 'missing' filenode thinks it belongs to a changenode we | 1512 drop = set() |
1513 # assume the recipient must have, then the recipient must have | |
1514 # that filenode. | |
1515 for n in missingnodes: | 1513 for n in missingnodes: |
1516 clrev = revlog.linkrev(revlog.rev(n)) | 1514 if revlog.linkrev(revlog.rev(n)) in commonrevs: |
1517 if clrev in commonrevs: | 1515 drop.add(n) |
1518 hasset.add(n) | 1516 for n in drop: |
1519 for n in hasset: | |
1520 missingnodes.pop(n, None) | 1517 missingnodes.pop(n, None) |
1521 for r in revlog.ancestors(*[revlog.rev(n) for n in hasset]): | |
1522 missingnodes.pop(revlog.node(r), None) | |
1523 | 1518 |
1524 # Now that we have all theses utility functions to help out and | 1519 # Now that we have all theses utility functions to help out and |
1525 # logically divide up the task, generate the group. | 1520 # logically divide up the task, generate the group. |
1526 def gengroup(): | 1521 def gengroup(): |
1527 # The set of changed files starts empty. | 1522 # The set of changed files starts empty. |