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 # This is a function generating function used to set up an environment |
|
1720 # for the inner function to execute in. |
|
1721 def manifest_and_file_collector(changedfileset): |
|
1722 # This is an information gathering function that gathers |
|
1723 # information from each changeset node that goes out as part of |
|
1724 # the changegroup. The information gathered is a list of which |
|
1725 # manifest nodes are potentially required (the recipient may |
|
1726 # already have them) and total list of all files which were |
|
1727 # changed in any changeset in the changegroup. |
|
1728 # |
|
1729 # We also remember the first changenode we saw any manifest |
|
1730 # referenced by so we can later determine which changenode 'owns' |
|
1731 # the manifest. |
|
1732 def collect_manifests_and_files(clnode): |
|
1733 c = cl.read(clnode) |
|
1734 for f in c[3]: |
|
1735 # This is to make sure we only have one instance of each |
|
1736 # filename string for each filename. |
|
1737 changedfileset.setdefault(f, f) |
|
1738 msng_mnfst_set.setdefault(c[0], clnode) |
|
1739 return collect_manifests_and_files |
|
1740 |
1718 |
1741 # Figure out which manifest nodes (of the ones we think might be part |
1719 # Figure out which manifest nodes (of the ones we think might be part |
1742 # of the changegroup) the recipient must know about and remove them |
1720 # of the changegroup) the recipient must know about and remove them |
1743 # from the changegroup. |
1721 # from the changegroup. |
1744 def prune_manifests(): |
1722 def prune_manifests(): |
1836 # Now that we have all theses utility functions to help out and |
1814 # Now that we have all theses utility functions to help out and |
1837 # logically divide up the task, generate the group. |
1815 # logically divide up the task, generate the group. |
1838 def gengroup(): |
1816 def gengroup(): |
1839 # The set of changed files starts empty. |
1817 # The set of changed files starts empty. |
1840 changedfiles = {} |
1818 changedfiles = {} |
|
1819 collect = changegroup.collector(cl, msng_mnfst_set, changedfiles) |
|
1820 |
1841 # Create a changenode group generator that will call our functions |
1821 # Create a changenode group generator that will call our functions |
1842 # back to lookup the owning changenode and collect information. |
1822 # back to lookup the owning changenode and collect information. |
1843 group = cl.group(msng_cl_lst, identity, |
1823 group = cl.group(msng_cl_lst, identity, collect) |
1844 manifest_and_file_collector(changedfiles)) |
|
1845 for chnk in group: |
1824 for chnk in group: |
1846 yield chnk |
1825 yield chnk |
1847 |
1826 |
1848 # The list of manifests has been collected by the generator |
1827 # The list of manifests has been collected by the generator |
1849 # calling our functions back. |
1828 # calling our functions back. |
1934 def gennodelst(log): |
1913 def gennodelst(log): |
1935 for r in log: |
1914 for r in log: |
1936 if log.linkrev(r) in revset: |
1915 if log.linkrev(r) in revset: |
1937 yield log.node(r) |
1916 yield log.node(r) |
1938 |
1917 |
1939 def changed_file_collector(changedfileset): |
|
1940 def collect_changed_files(clnode): |
|
1941 c = cl.read(clnode) |
|
1942 changedfileset.update(c[3]) |
|
1943 return collect_changed_files |
|
1944 |
|
1945 def lookuprevlink_func(revlog): |
1918 def lookuprevlink_func(revlog): |
1946 def lookuprevlink(n): |
1919 def lookuprevlink(n): |
1947 return cl.node(revlog.linkrev(revlog.rev(n))) |
1920 return cl.node(revlog.linkrev(revlog.rev(n))) |
1948 return lookuprevlink |
1921 return lookuprevlink |
1949 |
1922 |
1950 def gengroup(): |
1923 def gengroup(): |
1951 '''yield a sequence of changegroup chunks (strings)''' |
1924 '''yield a sequence of changegroup chunks (strings)''' |
1952 # construct a list of all changed files |
1925 # construct a list of all changed files |
1953 changedfiles = set() |
1926 changedfiles = {} |
1954 |
1927 mmfs = {} |
1955 for chnk in cl.group(nodes, identity, |
1928 collect = changegroup.collector(cl, mmfs, changedfiles) |
1956 changed_file_collector(changedfiles)): |
1929 |
|
1930 for chnk in cl.group(nodes, identity, collect): |
1957 yield chnk |
1931 yield chnk |
1958 |
1932 |
1959 mnfst = self.manifest |
1933 mnfst = self.manifest |
1960 nodeiter = gennodelst(mnfst) |
1934 nodeiter = gennodelst(mnfst) |
1961 for chnk in mnfst.group(nodeiter, lookuprevlink_func(mnfst)): |
1935 for chnk in mnfst.group(nodeiter, lookuprevlink_func(mnfst)): |