Show More
@@ -54,6 +54,16 b' bundletypes = {' | |||
|
54 | 54 | "HG10GZ": ("HG10GZ", lambda: zlib.compressobj()), |
|
55 | 55 | } |
|
56 | 56 | |
|
57 | def collector(cl, mmfs, files): | |
|
58 | # Gather information about changeset nodes going out in a bundle. | |
|
59 | # We want to gather manifests needed and filelogs affected. | |
|
60 | def collect(node): | |
|
61 | c = cl.read(node) | |
|
62 | for fn in c[3]: | |
|
63 | files.setdefault(fn, fn) | |
|
64 | mmfs.setdefault(c[0], node) | |
|
65 | return collect | |
|
66 | ||
|
57 | 67 | # hgweb uses this list to communicate its preferred type |
|
58 | 68 | bundlepriority = ['HG10GZ', 'HG10BZ', 'HG10UN'] |
|
59 | 69 |
@@ -1716,28 +1716,6 b' class localrepository(repo.repository):' | |||
|
1716 | 1716 | for r in revlog.ancestors(*[revlog.rev(n) for n in hasset]): |
|
1717 | 1717 | msngset.pop(revlog.node(r), None) |
|
1718 | 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 | ||
|
1741 | 1719 | # Figure out which manifest nodes (of the ones we think might be part |
|
1742 | 1720 | # of the changegroup) the recipient must know about and remove them |
|
1743 | 1721 | # from the changegroup. |
@@ -1838,10 +1816,11 b' class localrepository(repo.repository):' | |||
|
1838 | 1816 | def gengroup(): |
|
1839 | 1817 | # The set of changed files starts empty. |
|
1840 | 1818 | changedfiles = {} |
|
1819 | collect = changegroup.collector(cl, msng_mnfst_set, changedfiles) | |
|
1820 | ||
|
1841 | 1821 | # Create a changenode group generator that will call our functions |
|
1842 | 1822 | # back to lookup the owning changenode and collect information. |
|
1843 | group = cl.group(msng_cl_lst, identity, | |
|
1844 | manifest_and_file_collector(changedfiles)) | |
|
1823 | group = cl.group(msng_cl_lst, identity, collect) | |
|
1845 | 1824 | for chnk in group: |
|
1846 | 1825 | yield chnk |
|
1847 | 1826 | |
@@ -1936,12 +1915,6 b' class localrepository(repo.repository):' | |||
|
1936 | 1915 | if log.linkrev(r) in revset: |
|
1937 | 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 | 1918 | def lookuprevlink_func(revlog): |
|
1946 | 1919 | def lookuprevlink(n): |
|
1947 | 1920 | return cl.node(revlog.linkrev(revlog.rev(n))) |
@@ -1950,10 +1923,11 b' class localrepository(repo.repository):' | |||
|
1950 | 1923 | def gengroup(): |
|
1951 | 1924 | '''yield a sequence of changegroup chunks (strings)''' |
|
1952 | 1925 | # construct a list of all changed files |
|
1953 |
changedfiles = |
|
|
1926 | changedfiles = {} | |
|
1927 | mmfs = {} | |
|
1928 | collect = changegroup.collector(cl, mmfs, changedfiles) | |
|
1954 | 1929 | |
|
1955 | for chnk in cl.group(nodes, identity, | |
|
1956 | changed_file_collector(changedfiles)): | |
|
1930 | for chnk in cl.group(nodes, identity, collect): | |
|
1957 | 1931 | yield chnk |
|
1958 | 1932 | |
|
1959 | 1933 | mnfst = self.manifest |
General Comments 0
You need to be logged in to leave comments.
Login now