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