comparison mercurial/localrepo.py @ 11648:801533a52799

changegroup*(): use set instead of dict
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Thu, 22 Jul 2010 14:34:37 +0200
parents c4f6f0a1bd5a
children 08a269d9c4ca
comparison
equal deleted inserted replaced
11647:96d3d340f6ec 11648:801533a52799
1371 # If the previous rev is one of the parents, 1371 # If the previous rev is one of the parents,
1372 # we only need to see a diff. 1372 # we only need to see a diff.
1373 deltamf = mnfst.readdelta(mnfstnode) 1373 deltamf = mnfst.readdelta(mnfstnode)
1374 # For each line in the delta 1374 # For each line in the delta
1375 for f, fnode in deltamf.iteritems(): 1375 for f, fnode in deltamf.iteritems():
1376 f = changedfiles.get(f, None)
1377 # And if the file is in the list of files we care 1376 # And if the file is in the list of files we care
1378 # about. 1377 # about.
1379 if f is not None: 1378 if f in changedfiles:
1380 # Get the changenode this manifest belongs to 1379 # Get the changenode this manifest belongs to
1381 clnode = msng_mnfst_set[mnfstnode] 1380 clnode = msng_mnfst_set[mnfstnode]
1382 # Create the set of filenodes for the file if 1381 # Create the set of filenodes for the file if
1383 # there isn't one already. 1382 # there isn't one already.
1384 ndset = msng_filenode_set.setdefault(f, {}) 1383 ndset = msng_filenode_set.setdefault(f, {})
1433 1432
1434 # Now that we have all theses utility functions to help out and 1433 # Now that we have all theses utility functions to help out and
1435 # logically divide up the task, generate the group. 1434 # logically divide up the task, generate the group.
1436 def gengroup(): 1435 def gengroup():
1437 # The set of changed files starts empty. 1436 # The set of changed files starts empty.
1438 changedfiles = {} 1437 changedfiles = set()
1439 collect = changegroup.collector(cl, msng_mnfst_set, changedfiles) 1438 collect = changegroup.collector(cl, msng_mnfst_set, changedfiles)
1440 1439
1441 # Create a changenode group generator that will call our functions 1440 # Create a changenode group generator that will call our functions
1442 # back to lookup the owning changenode and collect information. 1441 # back to lookup the owning changenode and collect information.
1443 group = cl.group(msng_cl_lst, identity, collect) 1442 group = cl.group(msng_cl_lst, identity, collect)
1484 if extranodes: 1483 if extranodes:
1485 for fname in extranodes: 1484 for fname in extranodes:
1486 if isinstance(fname, int): 1485 if isinstance(fname, int):
1487 continue 1486 continue
1488 msng_filenode_set.setdefault(fname, {}) 1487 msng_filenode_set.setdefault(fname, {})
1489 changedfiles[fname] = 1 1488 changedfiles.add(fname)
1490 # Go through all our files in order sorted by name. 1489 # Go through all our files in order sorted by name.
1491 cnt = 0 1490 cnt = 0
1492 for fname in sorted(changedfiles): 1491 for fname in sorted(changedfiles):
1493 filerevlog = self.file(fname) 1492 filerevlog = self.file(fname)
1494 if not len(filerevlog): 1493 if not len(filerevlog):
1564 return lookuprevlink 1563 return lookuprevlink
1565 1564
1566 def gengroup(): 1565 def gengroup():
1567 '''yield a sequence of changegroup chunks (strings)''' 1566 '''yield a sequence of changegroup chunks (strings)'''
1568 # construct a list of all changed files 1567 # construct a list of all changed files
1569 changedfiles = {} 1568 changedfiles = set()
1570 mmfs = {} 1569 mmfs = {}
1571 collect = changegroup.collector(cl, mmfs, changedfiles) 1570 collect = changegroup.collector(cl, mmfs, changedfiles)
1572 1571
1573 cnt = 0 1572 cnt = 0
1574 for chnk in cl.group(nodes, identity, collect): 1573 for chnk in cl.group(nodes, identity, collect):