##// END OF EJS Templates
localrepo: use set instead of dict
Benoit Boissinot -
r8469:cb897f10 default
parent child Browse files
Show More
@@ -1382,20 +1382,20 b' class localrepository(repo.repository):'
1382 # find every node whose parents have been pruned
1382 # find every node whose parents have been pruned
1383 subset = []
1383 subset = []
1384 # find every remote head that will get new children
1384 # find every remote head that will get new children
1385 updated_heads = {}
1385 updated_heads = set()
1386 for n in remain:
1386 for n in remain:
1387 p1, p2 = self.changelog.parents(n)
1387 p1, p2 = self.changelog.parents(n)
1388 if p1 not in remain and p2 not in remain:
1388 if p1 not in remain and p2 not in remain:
1389 subset.append(n)
1389 subset.append(n)
1390 if heads:
1390 if heads:
1391 if p1 in heads:
1391 if p1 in heads:
1392 updated_heads[p1] = True
1392 updated_heads.add(p1)
1393 if p2 in heads:
1393 if p2 in heads:
1394 updated_heads[p2] = True
1394 updated_heads.add(p2)
1395
1395
1396 # this is the set of all roots we have to push
1396 # this is the set of all roots we have to push
1397 if heads:
1397 if heads:
1398 return subset, updated_heads.keys()
1398 return subset, list(updated_heads)
1399 else:
1399 else:
1400 return subset
1400 return subset
1401
1401
@@ -1575,13 +1575,13 b' class localrepository(repo.repository):'
1575
1575
1576 # Known heads are the list of heads that it is assumed the recipient
1576 # Known heads are the list of heads that it is assumed the recipient
1577 # of this changegroup will know about.
1577 # of this changegroup will know about.
1578 knownheads = {}
1578 knownheads = set()
1579 # We assume that all parents of bases are known heads.
1579 # We assume that all parents of bases are known heads.
1580 for n in bases:
1580 for n in bases:
1581 for p in cl.parents(n):
1581 for p in cl.parents(n):
1582 if p != nullid:
1582 if p != nullid:
1583 knownheads[p] = 1
1583 knownheads.add(p)
1584 knownheads = knownheads.keys()
1584 knownheads = list(knownheads)
1585 if knownheads:
1585 if knownheads:
1586 # Now that we know what heads are known, we can compute which
1586 # Now that we know what heads are known, we can compute which
1587 # changesets are known. The recipient must know about all
1587 # changesets are known. The recipient must know about all
@@ -1627,14 +1627,14 b' class localrepository(repo.repository):'
1627 # also assume the recipient will have all the parents. This function
1627 # also assume the recipient will have all the parents. This function
1628 # prunes them from the set of missing nodes.
1628 # prunes them from the set of missing nodes.
1629 def prune_parents(revlog, hasset, msngset):
1629 def prune_parents(revlog, hasset, msngset):
1630 haslst = hasset.keys()
1630 haslst = list(hasset)
1631 haslst.sort(cmp_by_rev_func(revlog))
1631 haslst.sort(cmp_by_rev_func(revlog))
1632 for node in haslst:
1632 for node in haslst:
1633 parentlst = [p for p in revlog.parents(node) if p != nullid]
1633 parentlst = [p for p in revlog.parents(node) if p != nullid]
1634 while parentlst:
1634 while parentlst:
1635 n = parentlst.pop()
1635 n = parentlst.pop()
1636 if n not in hasset:
1636 if n not in hasset:
1637 hasset[n] = 1
1637 hasset.add(n)
1638 p = [p for p in revlog.parents(n) if p != nullid]
1638 p = [p for p in revlog.parents(n) if p != nullid]
1639 parentlst.extend(p)
1639 parentlst.extend(p)
1640 for n in hasset:
1640 for n in hasset:
@@ -1666,14 +1666,14 b' class localrepository(repo.repository):'
1666 # of the changegroup) the recipient must know about and remove them
1666 # of the changegroup) the recipient must know about and remove them
1667 # from the changegroup.
1667 # from the changegroup.
1668 def prune_manifests():
1668 def prune_manifests():
1669 has_mnfst_set = {}
1669 has_mnfst_set = set()
1670 for n in msng_mnfst_set:
1670 for n in msng_mnfst_set:
1671 # If a 'missing' manifest thinks it belongs to a changenode
1671 # If a 'missing' manifest thinks it belongs to a changenode
1672 # the recipient is assumed to have, obviously the recipient
1672 # the recipient is assumed to have, obviously the recipient
1673 # must have that manifest.
1673 # must have that manifest.
1674 linknode = cl.node(mnfst.linkrev(mnfst.rev(n)))
1674 linknode = cl.node(mnfst.linkrev(mnfst.rev(n)))
1675 if linknode in has_cl_set:
1675 if linknode in has_cl_set:
1676 has_mnfst_set[n] = 1
1676 has_mnfst_set.add(n)
1677 prune_parents(mnfst, has_mnfst_set, msng_mnfst_set)
1677 prune_parents(mnfst, has_mnfst_set, msng_mnfst_set)
1678
1678
1679 # Use the information collected in collect_manifests_and_files to say
1679 # Use the information collected in collect_manifests_and_files to say
@@ -1732,14 +1732,14 b' class localrepository(repo.repository):'
1732 # all those we know the recipient must have.
1732 # all those we know the recipient must have.
1733 def prune_filenodes(f, filerevlog):
1733 def prune_filenodes(f, filerevlog):
1734 msngset = msng_filenode_set[f]
1734 msngset = msng_filenode_set[f]
1735 hasset = {}
1735 hasset = set()
1736 # If a 'missing' filenode thinks it belongs to a changenode we
1736 # If a 'missing' filenode thinks it belongs to a changenode we
1737 # assume the recipient must have, then the recipient must have
1737 # assume the recipient must have, then the recipient must have
1738 # that filenode.
1738 # that filenode.
1739 for n in msngset:
1739 for n in msngset:
1740 clnode = cl.node(filerevlog.linkrev(filerevlog.rev(n)))
1740 clnode = cl.node(filerevlog.linkrev(filerevlog.rev(n)))
1741 if clnode in has_cl_set:
1741 if clnode in has_cl_set:
1742 hasset[n] = 1
1742 hasset.add(n)
1743 prune_parents(filerevlog, hasset, msngset)
1743 prune_parents(filerevlog, hasset, msngset)
1744
1744
1745 # A function generator function that sets up the a context for the
1745 # A function generator function that sets up the a context for the
@@ -1867,7 +1867,7 b' class localrepository(repo.repository):'
1867 def collect_changed_files(clnode):
1867 def collect_changed_files(clnode):
1868 c = cl.read(clnode)
1868 c = cl.read(clnode)
1869 for fname in c[3]:
1869 for fname in c[3]:
1870 changedfileset[fname] = 1
1870 changedfileset.add(fname)
1871 return collect_changed_files
1871 return collect_changed_files
1872
1872
1873 def lookuprevlink_func(revlog):
1873 def lookuprevlink_func(revlog):
@@ -1877,7 +1877,7 b' class localrepository(repo.repository):'
1877
1877
1878 def gengroup():
1878 def gengroup():
1879 # construct a list of all changed files
1879 # construct a list of all changed files
1880 changedfiles = {}
1880 changedfiles = set()
1881
1881
1882 for chnk in cl.group(nodes, identity,
1882 for chnk in cl.group(nodes, identity,
1883 changed_file_collector(changedfiles)):
1883 changed_file_collector(changedfiles)):
General Comments 0
You need to be logged in to leave comments. Login now