comparison mercurial/localrepo.py @ 13786:4ed718f909e5

changegroup: roll changegroup.collector into lookup functions
author Matt Mackall <mpm@selenic.com>
date Mon, 28 Mar 2011 11:18:56 -0500
parents 470ec600b525
children 5333c87f6048
comparison
equal deleted inserted replaced
13785:470ec600b525 13786:4ed718f909e5
1528 # logically divide up the task, generate the group. 1528 # logically divide up the task, generate the group.
1529 def gengroup(): 1529 def gengroup():
1530 # The set of changed files starts empty. 1530 # The set of changed files starts empty.
1531 changedfiles = set() 1531 changedfiles = set()
1532 1532
1533 collect = changegroup.collector(cl, mfs, changedfiles)
1534 count = [0] 1533 count = [0]
1535 def clookup(revlog, x): 1534 def clookup(revlog, x):
1536 collect(x) 1535 c = cl.read(x)
1536 changedfiles.update(c[3])
1537 mfs.setdefault(c[0], x)
1537 count[0] += 1 1538 count[0] += 1
1538 self.ui.progress(_('bundling'), count[0], unit=_('changesets')) 1539 self.ui.progress(_('bundling'), count[0], unit=_('changesets'))
1539 return x 1540 return x
1540 1541
1541 # Create a changenode group generator that will call our functions 1542 # Create a changenode group generator that will call our functions
1635 '''yield a sequence of changegroup chunks (strings)''' 1636 '''yield a sequence of changegroup chunks (strings)'''
1636 # construct a list of all changed files 1637 # construct a list of all changed files
1637 changedfiles = set() 1638 changedfiles = set()
1638 mmfs = {} 1639 mmfs = {}
1639 1640
1640 collect = changegroup.collector(cl, mmfs, changedfiles)
1641 count = [0] 1641 count = [0]
1642 def clookup(revlog, x): 1642 def clookup(revlog, x):
1643 c = cl.read(x)
1644 changedfiles.update(c[3])
1645 mmfs.setdefault(c[0], x)
1643 count[0] += 1 1646 count[0] += 1
1644 self.ui.progress(_('bundling'), count[0], unit=_('changesets')) 1647 self.ui.progress(_('bundling'), count[0], unit=_('changesets'))
1645 collect(x)
1646 return x 1648 return x
1647 1649
1648 for chunk in cl.group(nodes, clookup): 1650 for chunk in cl.group(nodes, clookup):
1649 yield chunk 1651 yield chunk
1650 efiles = len(changedfiles) 1652 efiles = len(changedfiles)