##// END OF EJS Templates
changegroup: refactor prune as a filter
Matt Mackall -
r13810:0252abaa default
parent child Browse files
Show More
@@ -1488,18 +1488,11 b' class localrepository(repo.repository):'
1488 1488 self.hook('preoutgoing', throw=True, source=source)
1489 1489 self.changegroupinfo(csets, source)
1490 1490
1491 # If we determine that a particular file or manifest node must be a
1492 # node that the recipient of the changegroup will already have, we can
1493 # also assume the recipient will have all the parents. This function
1494 # prunes them from the set of missing nodes.
1495 def prune(revlog, missingnodes):
1496 # drop any nodes that claim to be part of a cset in commonrevs
1497 drop = set()
1498 for n in missingnodes:
1499 if revlog.linkrev(revlog.rev(n)) in commonrevs:
1500 drop.add(n)
1501 for n in drop:
1502 missingnodes.pop(n, None)
1491 # filter any nodes that claim to be part of the known set
1492 def prune(revlog, missing):
1493 for n in missing:
1494 if revlog.linkrev(revlog.rev(n)) not in commonrevs:
1495 yield n
1503 1496
1504 1497 # Now that we have all theses utility functions to help out and
1505 1498 # logically divide up the task, generate the group.
@@ -1524,7 +1517,6 b' class localrepository(repo.repository):'
1524 1517 efiles = len(changedfiles)
1525 1518 self.ui.progress(_('bundling'), None)
1526 1519
1527 prune(mf, mfs)
1528 1520 # Create a generator for the manifestnodes that calls our lookup
1529 1521 # and data collection functions back.
1530 1522 count = [0]
@@ -1539,7 +1531,7 b' class localrepository(repo.repository):'
1539 1531 unit=_('manifests'), total=changecount)
1540 1532 return mfs[x]
1541 1533
1542 for chunk in mf.group(mfs, mlookup):
1534 for chunk in mf.group(prune(mf, mfs), mlookup):
1543 1535 yield chunk
1544 1536 self.ui.progress(_('bundling'), None)
1545 1537
@@ -1553,7 +1545,6 b' class localrepository(repo.repository):'
1553 1545 # Toss out the filenodes that the recipient isn't really
1554 1546 # missing.
1555 1547 missingfnodes = fnodes.pop(fname, {})
1556 prune(filerevlog, missingfnodes)
1557 1548 first = True
1558 1549
1559 1550 def flookup(revlog, x):
@@ -1565,7 +1556,8 b' class localrepository(repo.repository):'
1565 1556 unit=_('files'), total=efiles)
1566 1557 return missingfnodes[x]
1567 1558
1568 for chunk in filerevlog.group(missingfnodes, flookup):
1559 for chunk in filerevlog.group(prune(filerevlog, missingfnodes),
1560 flookup):
1569 1561 if first:
1570 1562 if chunk == changegroup.closechunk():
1571 1563 break
General Comments 0
You need to be logged in to leave comments. Login now