comparison mercurial/localrepo.py @ 13785:470ec600b525

changegroup: add revlog to the group callback
author Matt Mackall <mpm@selenic.com>
date Mon, 28 Mar 2011 11:18:56 -0500
parents f1e639c71a2b
children 4ed718f909e5
comparison
equal deleted inserted replaced
13784:f1e639c71a2b 13785:470ec600b525
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) 1533 collect = changegroup.collector(cl, mfs, changedfiles)
1534 count = [0] 1534 count = [0]
1535 def clookup(x): 1535 def clookup(revlog, x):
1536 collect(x) 1536 collect(x)
1537 count[0] += 1 1537 count[0] += 1
1538 self.ui.progress(_('bundling'), count[0], unit=_('changesets')) 1538 self.ui.progress(_('bundling'), count[0], unit=_('changesets'))
1539 return x 1539 return x
1540 1540
1549 prune(mf, mfs) 1549 prune(mf, mfs)
1550 # Create a generator for the manifestnodes that calls our lookup 1550 # Create a generator for the manifestnodes that calls our lookup
1551 # and data collection functions back. 1551 # and data collection functions back.
1552 fcollect = filenode_collector(changedfiles) 1552 fcollect = filenode_collector(changedfiles)
1553 count = [0] 1553 count = [0]
1554 def mlookup(x): 1554 def mlookup(revlog, x):
1555 fcollect(x) 1555 fcollect(x)
1556 count[0] += 1 1556 count[0] += 1
1557 self.ui.progress(_('bundling'), count[0], 1557 self.ui.progress(_('bundling'), count[0],
1558 unit=_('manifests'), total=changecount) 1558 unit=_('manifests'), total=changecount)
1559 return mfs[x] 1559 return mfs[x]
1579 yield changegroup.chunkheader(len(fname)) 1579 yield changegroup.chunkheader(len(fname))
1580 yield fname 1580 yield fname
1581 # Create a group generator and only pass in a changenode 1581 # Create a group generator and only pass in a changenode
1582 # lookup function as we need to collect no information 1582 # lookup function as we need to collect no information
1583 # from filenodes. 1583 # from filenodes.
1584 def flookup(x): 1584 def flookup(revlog, x):
1585 # even though we print the same progress on 1585 # even though we print the same progress on
1586 # most loop iterations, put the progress call 1586 # most loop iterations, put the progress call
1587 # here so that time estimates (if any) can be updated 1587 # here so that time estimates (if any) can be updated
1588 self.ui.progress( 1588 self.ui.progress(
1589 _('bundling'), idx, item=fname, 1589 _('bundling'), idx, item=fname,
1637 changedfiles = set() 1637 changedfiles = set()
1638 mmfs = {} 1638 mmfs = {}
1639 1639
1640 collect = changegroup.collector(cl, mmfs, changedfiles) 1640 collect = changegroup.collector(cl, mmfs, changedfiles)
1641 count = [0] 1641 count = [0]
1642 def clookup(x): 1642 def clookup(revlog, x):
1643 count[0] += 1 1643 count[0] += 1
1644 self.ui.progress(_('bundling'), count[0], unit=_('changesets')) 1644 self.ui.progress(_('bundling'), count[0], unit=_('changesets'))
1645 collect(x) 1645 collect(x)
1646 return x 1646 return x
1647 1647
1653 1653
1654 mnfst = self.manifest 1654 mnfst = self.manifest
1655 nodeiter = gennodelst(mnfst) 1655 nodeiter = gennodelst(mnfst)
1656 mfunc = lookuplinkrev_func(mnfst) 1656 mfunc = lookuplinkrev_func(mnfst)
1657 count = [0] 1657 count = [0]
1658 def mlookup(x): 1658 def mlookup(revlog, x):
1659 count[0] += 1 1659 count[0] += 1
1660 self.ui.progress(_('bundling'), count[0], 1660 self.ui.progress(_('bundling'), count[0],
1661 unit=_('manifests'), total=changecount) 1661 unit=_('manifests'), total=changecount)
1662 return mfunc(x) 1662 return mfunc(x)
1663 1663
1673 nodeiter = list(nodeiter) 1673 nodeiter = list(nodeiter)
1674 if nodeiter: 1674 if nodeiter:
1675 yield changegroup.chunkheader(len(fname)) 1675 yield changegroup.chunkheader(len(fname))
1676 yield fname 1676 yield fname
1677 ffunc = lookuplinkrev_func(filerevlog) 1677 ffunc = lookuplinkrev_func(filerevlog)
1678 def flookup(x): 1678 def flookup(revlog, x):
1679 self.ui.progress( 1679 self.ui.progress(
1680 _('bundling'), idx, item=fname, 1680 _('bundling'), idx, item=fname,
1681 total=efiles, unit=_('files')) 1681 total=efiles, unit=_('files'))
1682 return ffunc(x) 1682 return ffunc(x)
1683 1683