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