##// END OF EJS Templates
changegroup: unnest some lookup functions
Matt Mackall -
r13813:76593ef3 default
parent child Browse files
Show More
@@ -1479,6 +1479,7 b' class localrepository(repo.repository):'
1479 mfs = {} # needed manifests
1479 mfs = {} # needed manifests
1480 fnodes = {} # needed file nodes
1480 fnodes = {} # needed file nodes
1481 changedfiles = set()
1481 changedfiles = set()
1482 count = [0]
1482
1483
1483 # can we go through the fast path ?
1484 # can we go through the fast path ?
1484 heads.sort()
1485 heads.sort()
@@ -1495,42 +1496,38 b' class localrepository(repo.repository):'
1495 if revlog.linkrev(revlog.rev(n)) not in commonrevs:
1496 if revlog.linkrev(revlog.rev(n)) not in commonrevs:
1496 yield n
1497 yield n
1497
1498
1499 def clookup(revlog, x):
1500 c = cl.read(x)
1501 changedfiles.update(c[3])
1502 mfs.setdefault(c[0], x)
1503 count[0] += 1
1504 self.ui.progress(_('bundling'), count[0], unit=_('changesets'))
1505 return x
1506
1507 def mlookup(revlog, x):
1508 clnode = mfs[x]
1509 mdata = mf.readfast(x)
1510 for f in changedfiles:
1511 if f in mdata:
1512 fnodes.setdefault(f, {}).setdefault(mdata[f], clnode)
1513 count[0] += 1
1514 self.ui.progress(_('bundling'), count[0],
1515 unit=_('manifests'), total=len(mfs))
1516 return mfs[x]
1517
1498 # Now that we have all theses utility functions to help out and
1518 # Now that we have all theses utility functions to help out and
1499 # logically divide up the task, generate the group.
1519 # logically divide up the task, generate the group.
1500 def gengroup():
1520 def gengroup():
1501 # The set of changed files starts empty.
1502
1503 count = [0]
1504 def clookup(revlog, x):
1505 c = cl.read(x)
1506 changedfiles.update(c[3])
1507 mfs.setdefault(c[0], x)
1508 count[0] += 1
1509 self.ui.progress(_('bundling'), count[0], unit=_('changesets'))
1510 return x
1511
1512 # Create a changenode group generator that will call our functions
1521 # Create a changenode group generator that will call our functions
1513 # back to lookup the owning changenode and collect information.
1522 # back to lookup the owning changenode and collect information.
1514 for chunk in cl.group(csets, clookup):
1523 for chunk in cl.group(csets, clookup):
1515 yield chunk
1524 yield chunk
1516 changecount = count[0]
1517 efiles = len(changedfiles)
1525 efiles = len(changedfiles)
1518 self.ui.progress(_('bundling'), None)
1526 self.ui.progress(_('bundling'), None)
1519
1527
1520 # Create a generator for the manifestnodes that calls our lookup
1528 # Create a generator for the manifestnodes that calls our lookup
1521 # and data collection functions back.
1529 # and data collection functions back.
1522 count = [0]
1530 count[0] = 0
1523 def mlookup(revlog, x):
1524 clnode = mfs[x]
1525 mdata = mf.readfast(x)
1526 for f in changedfiles:
1527 if f in mdata:
1528 fnodes.setdefault(f, {}).setdefault(mdata[f], clnode)
1529 count[0] += 1
1530 self.ui.progress(_('bundling'), count[0],
1531 unit=_('manifests'), total=changecount)
1532 return mfs[x]
1533
1534 for chunk in mf.group(prune(mf, mfs), mlookup):
1531 for chunk in mf.group(prune(mf, mfs), mlookup):
1535 yield chunk
1532 yield chunk
1536 self.ui.progress(_('bundling'), None)
1533 self.ui.progress(_('bundling'), None)
General Comments 0
You need to be logged in to leave comments. Login now