##// END OF EJS Templates
changegroup: combine lookup functions
Matt Mackall -
r13830:2dc6e09f default
parent child Browse files
Show More
@@ -1497,44 +1497,43 b' class localrepository(repo.repository):'
1497 if revlog.linkrev(revlog.rev(n)) not in commonrevs:
1497 if revlog.linkrev(revlog.rev(n)) not in commonrevs:
1498 yield n
1498 yield n
1499
1499
1500 def clookup(revlog, x):
1500 def lookup(revlog, x):
1501 c = cl.read(x)
1501 if revlog == cl:
1502 changedfiles.update(c[3])
1502 c = cl.read(x)
1503 mfs.setdefault(c[0], x)
1503 changedfiles.update(c[3])
1504 count[0] += 1
1504 mfs.setdefault(c[0], x)
1505 self.ui.progress(_('bundling'), count[0], unit=_('changesets'))
1505 count[0] += 1
1506 return x
1506 self.ui.progress(_('bundling'), count[0], unit=_('changesets'))
1507
1507 return x
1508 def mlookup(revlog, x):
1508 elif revlog == mf:
1509 clnode = mfs[x]
1509 clnode = mfs[x]
1510 mdata = mf.readfast(x)
1510 mdata = mf.readfast(x)
1511 for f in changedfiles:
1511 for f in changedfiles:
1512 if f in mdata:
1512 if f in mdata:
1513 fnodes.setdefault(f, {}).setdefault(mdata[f], clnode)
1513 fnodes.setdefault(f, {}).setdefault(mdata[f], clnode)
1514 count[0] += 1
1514 count[0] += 1
1515 self.ui.progress(_('bundling'), count[0],
1515 self.ui.progress(_('bundling'), count[0],
1516 unit=_('manifests'), total=len(mfs))
1516 unit=_('manifests'), total=len(mfs))
1517 return mfs[x]
1517 return mfs[x]
1518
1518 else:
1519 def flookup(revlog, x):
1519 self.ui.progress(
1520 self.ui.progress(
1520 _('bundling'), count[0], item=fstate[0],
1521 _('bundling'), count[0], item=fstate[0],
1521 unit=_('files'), total=len(changedfiles))
1522 unit=_('files'), total=len(changedfiles))
1522 return fstate[1][x]
1523 return fstate[1][x]
1524
1523
1525 # Now that we have all theses utility functions to help out and
1524 # Now that we have all theses utility functions to help out and
1526 # logically divide up the task, generate the group.
1525 # logically divide up the task, generate the group.
1527 def gengroup():
1526 def gengroup():
1528 # Create a changenode group generator that will call our functions
1527 # Create a changenode group generator that will call our functions
1529 # back to lookup the owning changenode and collect information.
1528 # back to lookup the owning changenode and collect information.
1530 for chunk in cl.group(csets, clookup):
1529 for chunk in cl.group(csets, lookup):
1531 yield chunk
1530 yield chunk
1532 self.ui.progress(_('bundling'), None)
1531 self.ui.progress(_('bundling'), None)
1533
1532
1534 # Create a generator for the manifestnodes that calls our lookup
1533 # Create a generator for the manifestnodes that calls our lookup
1535 # and data collection functions back.
1534 # and data collection functions back.
1536 count[0] = 0
1535 count[0] = 0
1537 for chunk in mf.group(prune(mf, mfs), mlookup):
1536 for chunk in mf.group(prune(mf, mfs), lookup):
1538 yield chunk
1537 yield chunk
1539 self.ui.progress(_('bundling'), None)
1538 self.ui.progress(_('bundling'), None)
1540
1539
@@ -1551,7 +1550,7 b' class localrepository(repo.repository):'
1551 first = True
1550 first = True
1552
1551
1553 for chunk in filerevlog.group(prune(filerevlog, fstate[1]),
1552 for chunk in filerevlog.group(prune(filerevlog, fstate[1]),
1554 flookup):
1553 lookup):
1555 if first:
1554 if first:
1556 if chunk == changegroup.closechunk():
1555 if chunk == changegroup.closechunk():
1557 break
1556 break
@@ -1600,36 +1599,35 b' class localrepository(repo.repository):'
1600 if log.linkrev(r) in revset:
1599 if log.linkrev(r) in revset:
1601 yield log.node(r)
1600 yield log.node(r)
1602
1601
1603 def clookup(revlog, x):
1602 def lookup(revlog, x):
1604 c = cl.read(x)
1603 if revlog == cl:
1605 changedfiles.update(c[3])
1604 c = cl.read(x)
1606 mfs.setdefault(c[0], x)
1605 changedfiles.update(c[3])
1607 count[0] += 1
1606 mfs.setdefault(c[0], x)
1608 self.ui.progress(_('bundling'), count[0], unit=_('changesets'))
1607 count[0] += 1
1609 return x
1608 self.ui.progress(_('bundling'), count[0], unit=_('changesets'))
1610
1609 return x
1611 def mlookup(revlog, x):
1610 elif revlog == mf:
1612 count[0] += 1
1611 count[0] += 1
1613 self.ui.progress(_('bundling'), count[0],
1612 self.ui.progress(_('bundling'), count[0],
1614 unit=_('manifests'), total=len(mfs))
1613 unit=_('manifests'), total=len(mfs))
1615 return cl.node(revlog.linkrev(revlog.rev(x)))
1614 return cl.node(revlog.linkrev(revlog.rev(x)))
1616
1615 else:
1617 def flookup(revlog, x):
1616 self.ui.progress(
1618 self.ui.progress(
1617 _('bundling'), count[0], item=fstate[0],
1619 _('bundling'), count[0], item=fstate[0],
1618 total=len(changedfiles), unit=_('files'))
1620 total=len(changedfiles), unit=_('files'))
1619 return cl.node(revlog.linkrev(revlog.rev(x)))
1621 return cl.node(revlog.linkrev(revlog.rev(x)))
1622
1620
1623 def gengroup():
1621 def gengroup():
1624 '''yield a sequence of changegroup chunks (strings)'''
1622 '''yield a sequence of changegroup chunks (strings)'''
1625 # construct a list of all changed files
1623 # construct a list of all changed files
1626
1624
1627 for chunk in cl.group(nodes, clookup):
1625 for chunk in cl.group(nodes, lookup):
1628 yield chunk
1626 yield chunk
1629 self.ui.progress(_('bundling'), None)
1627 self.ui.progress(_('bundling'), None)
1630
1628
1631 count[0] = 0
1629 count[0] = 0
1632 for chunk in mf.group(gennodelst(mf), mlookup):
1630 for chunk in mf.group(gennodelst(mf), lookup):
1633 yield chunk
1631 yield chunk
1634 self.ui.progress(_('bundling'), None)
1632 self.ui.progress(_('bundling'), None)
1635
1633
@@ -1640,7 +1638,7 b' class localrepository(repo.repository):'
1640 raise util.Abort(_("empty or missing revlog for %s") % fname)
1638 raise util.Abort(_("empty or missing revlog for %s") % fname)
1641 fstate[0] = fname
1639 fstate[0] = fname
1642 first = True
1640 first = True
1643 for chunk in filerevlog.group(gennodelst(filerevlog), flookup):
1641 for chunk in filerevlog.group(gennodelst(filerevlog), lookup):
1644 if first:
1642 if first:
1645 if chunk == changegroup.closechunk():
1643 if chunk == changegroup.closechunk():
1646 break
1644 break
General Comments 0
You need to be logged in to leave comments. Login now