##// 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,12 +1496,6 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
1498 # Now that we have all theses utility functions to help out and
1499 # logically divide up the task, generate the group.
1500 def gengroup():
1501 # The set of changed files starts empty.
1502
1503 count = [0]
1504 def clookup(revlog, x):
1499 def clookup(revlog, x):
1505 c = cl.read(x)
1500 c = cl.read(x)
1506 changedfiles.update(c[3])
1501 changedfiles.update(c[3])
@@ -1509,17 +1504,6 b' class localrepository(repo.repository):'
1509 self.ui.progress(_('bundling'), count[0], unit=_('changesets'))
1504 self.ui.progress(_('bundling'), count[0], unit=_('changesets'))
1510 return x
1505 return x
1511
1506
1512 # Create a changenode group generator that will call our functions
1513 # back to lookup the owning changenode and collect information.
1514 for chunk in cl.group(csets, clookup):
1515 yield chunk
1516 changecount = count[0]
1517 efiles = len(changedfiles)
1518 self.ui.progress(_('bundling'), None)
1519
1520 # Create a generator for the manifestnodes that calls our lookup
1521 # and data collection functions back.
1522 count = [0]
1523 def mlookup(revlog, x):
1507 def mlookup(revlog, x):
1524 clnode = mfs[x]
1508 clnode = mfs[x]
1525 mdata = mf.readfast(x)
1509 mdata = mf.readfast(x)
@@ -1528,9 +1512,22 b' class localrepository(repo.repository):'
1528 fnodes.setdefault(f, {}).setdefault(mdata[f], clnode)
1512 fnodes.setdefault(f, {}).setdefault(mdata[f], clnode)
1529 count[0] += 1
1513 count[0] += 1
1530 self.ui.progress(_('bundling'), count[0],
1514 self.ui.progress(_('bundling'), count[0],
1531 unit=_('manifests'), total=changecount)
1515 unit=_('manifests'), total=len(mfs))
1532 return mfs[x]
1516 return mfs[x]
1533
1517
1518 # Now that we have all theses utility functions to help out and
1519 # logically divide up the task, generate the group.
1520 def gengroup():
1521 # Create a changenode group generator that will call our functions
1522 # back to lookup the owning changenode and collect information.
1523 for chunk in cl.group(csets, clookup):
1524 yield chunk
1525 efiles = len(changedfiles)
1526 self.ui.progress(_('bundling'), None)
1527
1528 # Create a generator for the manifestnodes that calls our lookup
1529 # and data collection functions back.
1530 count[0] = 0
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