##// END OF EJS Templates
changegroupsubset: drop repeated len() calls
Matt Mackall -
r16421:859ef739 default
parent child Browse files
Show More
@@ -1820,7 +1820,7 b' class localrepository(repo.repository):'
1820 1820 fnodes = {} # needed file nodes
1821 1821 changedfiles = set()
1822 1822 fstate = ['', {}]
1823 count = [0]
1823 count = [0, 0]
1824 1824
1825 1825 # can we go through the fast path ?
1826 1826 heads.sort()
@@ -1849,7 +1849,7 b' class localrepository(repo.repository):'
1849 1849 mfs.setdefault(c[0], x)
1850 1850 count[0] += 1
1851 1851 progress(_bundling, count[0],
1852 unit=_changesets, total=len(csets))
1852 unit=_changesets, total=count[1])
1853 1853 return x
1854 1854 elif revlog == mf:
1855 1855 clnode = mfs[x]
@@ -1859,11 +1859,11 b' class localrepository(repo.repository):'
1859 1859 fnodes.setdefault(f, {}).setdefault(mdata[f], clnode)
1860 1860 count[0] += 1
1861 1861 progress(_bundling, count[0],
1862 unit=_manifests, total=len(mfs))
1862 unit=_manifests, total=count[1])
1863 1863 return mfs[x]
1864 1864 else:
1865 1865 progress(_bundling, count[0], item=fstate[0],
1866 unit=_files, total=len(changedfiles))
1866 unit=_files, total=count[1])
1867 1867 return fstate[1][x]
1868 1868
1869 1869 bundler = changegroup.bundle10(lookup)
@@ -1876,13 +1876,14 b' class localrepository(repo.repository):'
1876 1876 def gengroup():
1877 1877 # Create a changenode group generator that will call our functions
1878 1878 # back to lookup the owning changenode and collect information.
1879 count[:] = [0, len(csets)]
1879 1880 for chunk in cl.group(csets, bundler, reorder=reorder):
1880 1881 yield chunk
1881 1882 progress(_bundling, None)
1882 1883
1883 1884 # Create a generator for the manifestnodes that calls our lookup
1884 1885 # and data collection functions back.
1885 count[0] = 0
1886 count[:] = [0, len(mfs)]
1886 1887 for chunk in mf.group(prune(mf, mfs), bundler, reorder=reorder):
1887 1888 yield chunk
1888 1889 progress(_bundling, None)
@@ -1890,7 +1891,7 b' class localrepository(repo.repository):'
1890 1891 mfs.clear()
1891 1892
1892 1893 # Go through all our files in order sorted by name.
1893 count[0] = 0
1894 count[:] = [0, len(changedfiles)]
1894 1895 for fname in sorted(changedfiles):
1895 1896 filerevlog = self.file(fname)
1896 1897 if not len(filerevlog):
@@ -1933,7 +1934,7 b' class localrepository(repo.repository):'
1933 1934 mfs = {}
1934 1935 changedfiles = set()
1935 1936 fstate = ['']
1936 count = [0]
1937 count = [0, 0]
1937 1938
1938 1939 self.hook('preoutgoing', throw=True, source=source)
1939 1940 self.changegroupinfo(nodes, source)
@@ -1955,16 +1956,16 b' class localrepository(repo.repository):'
1955 1956 mfs.setdefault(c[0], x)
1956 1957 count[0] += 1
1957 1958 progress(_bundling, count[0],
1958 unit=_changesets, total=len(nodes))
1959 unit=_changesets, total=count[1])
1959 1960 return x
1960 1961 elif revlog == mf:
1961 1962 count[0] += 1
1962 1963 progress(_bundling, count[0],
1963 unit=_manifests, total=len(mfs))
1964 unit=_manifests, total=count[1])
1964 1965 return cl.node(revlog.linkrev(revlog.rev(x)))
1965 1966 else:
1966 1967 progress(_bundling, count[0], item=fstate[0],
1967 total=len(changedfiles), unit=_files)
1968 total=count[1], unit=_files)
1968 1969 return cl.node(revlog.linkrev(revlog.rev(x)))
1969 1970
1970 1971 bundler = changegroup.bundle10(lookup)
@@ -1978,16 +1979,17 b' class localrepository(repo.repository):'
1978 1979 '''yield a sequence of changegroup chunks (strings)'''
1979 1980 # construct a list of all changed files
1980 1981
1982 count[:] = [0, len(nodes)]
1981 1983 for chunk in cl.group(nodes, bundler, reorder=reorder):
1982 1984 yield chunk
1983 1985 progress(_bundling, None)
1984 1986
1985 count[0] = 0
1987 count[:] = [0, len(mfs)]
1986 1988 for chunk in mf.group(gennodelst(mf), bundler, reorder=reorder):
1987 1989 yield chunk
1988 1990 progress(_bundling, None)
1989 1991
1990 count[0] = 0
1992 count[:] = [0, len(changedfiles)]
1991 1993 for fname in sorted(changedfiles):
1992 1994 filerevlog = self.file(fname)
1993 1995 if not len(filerevlog):
General Comments 0
You need to be logged in to leave comments. Login now