Mercurial > public > mercurial-scm > hg
comparison mercurial/localrepo.py @ 10357:0d64b30b35c3
localrepo: inline single-use nested function
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Sun, 07 Feb 2010 10:01:55 +0100 |
parents | bc2414948012 |
children | eacfff116e17 |
comparison
equal
deleted
inserted
replaced
10356:bc2414948012 | 10357:0d64b30b35c3 |
---|---|
1713 # also assume the recipient will have all the parents. This function | 1713 # also assume the recipient will have all the parents. This function |
1714 # prunes them from the set of missing nodes. | 1714 # prunes them from the set of missing nodes. |
1715 def prune_parents(revlog, hasset, msngset): | 1715 def prune_parents(revlog, hasset, msngset): |
1716 for r in revlog.ancestors(*[revlog.rev(n) for n in hasset]): | 1716 for r in revlog.ancestors(*[revlog.rev(n) for n in hasset]): |
1717 msngset.pop(revlog.node(r), None) | 1717 msngset.pop(revlog.node(r), None) |
1718 | |
1719 # Figure out which manifest nodes (of the ones we think might be part | |
1720 # of the changegroup) the recipient must know about and remove them | |
1721 # from the changegroup. | |
1722 def prune_manifests(): | |
1723 has_mnfst_set = set() | |
1724 for n in msng_mnfst_set: | |
1725 # If a 'missing' manifest thinks it belongs to a changenode | |
1726 # the recipient is assumed to have, obviously the recipient | |
1727 # must have that manifest. | |
1728 linknode = cl.node(mnfst.linkrev(mnfst.rev(n))) | |
1729 if linknode in has_cl_set: | |
1730 has_mnfst_set.add(n) | |
1731 prune_parents(mnfst, has_mnfst_set, msng_mnfst_set) | |
1732 | 1718 |
1733 # Use the information collected in collect_manifests_and_files to say | 1719 # Use the information collected in collect_manifests_and_files to say |
1734 # which changenode any manifestnode belongs to. | 1720 # which changenode any manifestnode belongs to. |
1735 def lookup_manifest_link(mnfstnode): | 1721 def lookup_manifest_link(mnfstnode): |
1736 return msng_mnfst_set[mnfstnode] | 1722 return msng_mnfst_set[mnfstnode] |
1822 # back to lookup the owning changenode and collect information. | 1808 # back to lookup the owning changenode and collect information. |
1823 group = cl.group(msng_cl_lst, identity, collect) | 1809 group = cl.group(msng_cl_lst, identity, collect) |
1824 for chnk in group: | 1810 for chnk in group: |
1825 yield chnk | 1811 yield chnk |
1826 | 1812 |
1827 # The list of manifests has been collected by the generator | 1813 # Figure out which manifest nodes (of the ones we think might be |
1828 # calling our functions back. | 1814 # part of the changegroup) the recipient must know about and |
1829 prune_manifests() | 1815 # remove them from the changegroup. |
1816 has_mnfst_set = set() | |
1817 for n in msng_mnfst_set: | |
1818 # If a 'missing' manifest thinks it belongs to a changenode | |
1819 # the recipient is assumed to have, obviously the recipient | |
1820 # must have that manifest. | |
1821 linknode = cl.node(mnfst.linkrev(mnfst.rev(n))) | |
1822 if linknode in has_cl_set: | |
1823 has_mnfst_set.add(n) | |
1824 prune_parents(mnfst, has_mnfst_set, msng_mnfst_set) | |
1830 add_extra_nodes(1, msng_mnfst_set) | 1825 add_extra_nodes(1, msng_mnfst_set) |
1831 msng_mnfst_lst = msng_mnfst_set.keys() | 1826 msng_mnfst_lst = msng_mnfst_set.keys() |
1832 # Sort the manifestnodes by revision number. | 1827 # Sort the manifestnodes by revision number. |
1833 msng_mnfst_lst.sort(key=mnfst.rev) | 1828 msng_mnfst_lst.sort(key=mnfst.rev) |
1834 # Create a generator for the manifestnodes that calls our lookup | 1829 # Create a generator for the manifestnodes that calls our lookup |