##// END OF EJS Templates
changegroup: reduce progress overhead
Matt Mackall -
r16420:4df2d335 default
parent child Browse files
Show More
@@ -1836,14 +1836,20 b' class localrepository(repo.repository):'
1836 return [n for n in missing
1836 return [n for n in missing
1837 if revlog.linkrev(revlog.rev(n)) not in commonrevs]
1837 if revlog.linkrev(revlog.rev(n)) not in commonrevs]
1838
1838
1839 progress = self.ui.progress
1840 _bundling = _('bundling')
1841 _changesets = _('changesets')
1842 _manifests = _('manifests')
1843 _files = _('files')
1844
1839 def lookup(revlog, x):
1845 def lookup(revlog, x):
1840 if revlog == cl:
1846 if revlog == cl:
1841 c = cl.read(x)
1847 c = cl.read(x)
1842 changedfiles.update(c[3])
1848 changedfiles.update(c[3])
1843 mfs.setdefault(c[0], x)
1849 mfs.setdefault(c[0], x)
1844 count[0] += 1
1850 count[0] += 1
1845 self.ui.progress(_('bundling'), count[0],
1851 progress(_bundling, count[0],
1846 unit=_('changesets'), total=len(csets))
1852 unit=_changesets, total=len(csets))
1847 return x
1853 return x
1848 elif revlog == mf:
1854 elif revlog == mf:
1849 clnode = mfs[x]
1855 clnode = mfs[x]
@@ -1852,13 +1858,12 b' class localrepository(repo.repository):'
1852 if f in changedfiles:
1858 if f in changedfiles:
1853 fnodes.setdefault(f, {}).setdefault(mdata[f], clnode)
1859 fnodes.setdefault(f, {}).setdefault(mdata[f], clnode)
1854 count[0] += 1
1860 count[0] += 1
1855 self.ui.progress(_('bundling'), count[0],
1861 progress(_bundling, count[0],
1856 unit=_('manifests'), total=len(mfs))
1862 unit=_manifests, total=len(mfs))
1857 return mfs[x]
1863 return mfs[x]
1858 else:
1864 else:
1859 self.ui.progress(
1865 progress(_bundling, count[0], item=fstate[0],
1860 _('bundling'), count[0], item=fstate[0],
1866 unit=_files, total=len(changedfiles))
1861 unit=_('files'), total=len(changedfiles))
1862 return fstate[1][x]
1867 return fstate[1][x]
1863
1868
1864 bundler = changegroup.bundle10(lookup)
1869 bundler = changegroup.bundle10(lookup)
@@ -1873,14 +1878,14 b' class localrepository(repo.repository):'
1873 # back to lookup the owning changenode and collect information.
1878 # back to lookup the owning changenode and collect information.
1874 for chunk in cl.group(csets, bundler, reorder=reorder):
1879 for chunk in cl.group(csets, bundler, reorder=reorder):
1875 yield chunk
1880 yield chunk
1876 self.ui.progress(_('bundling'), None)
1881 progress(_bundling, None)
1877
1882
1878 # Create a generator for the manifestnodes that calls our lookup
1883 # Create a generator for the manifestnodes that calls our lookup
1879 # and data collection functions back.
1884 # and data collection functions back.
1880 count[0] = 0
1885 count[0] = 0
1881 for chunk in mf.group(prune(mf, mfs), bundler, reorder=reorder):
1886 for chunk in mf.group(prune(mf, mfs), bundler, reorder=reorder):
1882 yield chunk
1887 yield chunk
1883 self.ui.progress(_('bundling'), None)
1888 progress(_bundling, None)
1884
1889
1885 mfs.clear()
1890 mfs.clear()
1886
1891
@@ -1902,7 +1907,7 b' class localrepository(repo.repository):'
1902
1907
1903 # Signal that no more groups are left.
1908 # Signal that no more groups are left.
1904 yield bundler.close()
1909 yield bundler.close()
1905 self.ui.progress(_('bundling'), None)
1910 progress(_bundling, None)
1906
1911
1907 if csets:
1912 if csets:
1908 self.hook('outgoing', node=hex(csets[0]), source=source)
1913 self.hook('outgoing', node=hex(csets[0]), source=source)
@@ -1937,6 +1942,11 b' class localrepository(repo.repository):'
1937
1942
1938 def gennodelst(log):
1943 def gennodelst(log):
1939 return [log.node(r) for r in log if log.linkrev(r) in revset]
1944 return [log.node(r) for r in log if log.linkrev(r) in revset]
1945 progress = self.ui.progress
1946 _bundling = _('bundling')
1947 _changesets = _('changesets')
1948 _manifests = _('manifests')
1949 _files = _('files')
1940
1950
1941 def lookup(revlog, x):
1951 def lookup(revlog, x):
1942 if revlog == cl:
1952 if revlog == cl:
@@ -1944,18 +1954,17 b' class localrepository(repo.repository):'
1944 changedfiles.update(c[3])
1954 changedfiles.update(c[3])
1945 mfs.setdefault(c[0], x)
1955 mfs.setdefault(c[0], x)
1946 count[0] += 1
1956 count[0] += 1
1947 self.ui.progress(_('bundling'), count[0],
1957 progress(_bundling, count[0],
1948 unit=_('changesets'), total=len(nodes))
1958 unit=_changesets, total=len(nodes))
1949 return x
1959 return x
1950 elif revlog == mf:
1960 elif revlog == mf:
1951 count[0] += 1
1961 count[0] += 1
1952 self.ui.progress(_('bundling'), count[0],
1962 progress(_bundling, count[0],
1953 unit=_('manifests'), total=len(mfs))
1963 unit=_manifests, total=len(mfs))
1954 return cl.node(revlog.linkrev(revlog.rev(x)))
1964 return cl.node(revlog.linkrev(revlog.rev(x)))
1955 else:
1965 else:
1956 self.ui.progress(
1966 progress(_bundling, count[0], item=fstate[0],
1957 _('bundling'), count[0], item=fstate[0],
1967 total=len(changedfiles), unit=_files)
1958 total=len(changedfiles), unit=_('files'))
1959 return cl.node(revlog.linkrev(revlog.rev(x)))
1968 return cl.node(revlog.linkrev(revlog.rev(x)))
1960
1969
1961 bundler = changegroup.bundle10(lookup)
1970 bundler = changegroup.bundle10(lookup)
@@ -1971,12 +1980,12 b' class localrepository(repo.repository):'
1971
1980
1972 for chunk in cl.group(nodes, bundler, reorder=reorder):
1981 for chunk in cl.group(nodes, bundler, reorder=reorder):
1973 yield chunk
1982 yield chunk
1974 self.ui.progress(_('bundling'), None)
1983 progress(_bundling, None)
1975
1984
1976 count[0] = 0
1985 count[0] = 0
1977 for chunk in mf.group(gennodelst(mf), bundler, reorder=reorder):
1986 for chunk in mf.group(gennodelst(mf), bundler, reorder=reorder):
1978 yield chunk
1987 yield chunk
1979 self.ui.progress(_('bundling'), None)
1988 progress(_bundling, None)
1980
1989
1981 count[0] = 0
1990 count[0] = 0
1982 for fname in sorted(changedfiles):
1991 for fname in sorted(changedfiles):
@@ -1991,7 +2000,7 b' class localrepository(repo.repository):'
1991 for chunk in filerevlog.group(nodelist, bundler, reorder):
2000 for chunk in filerevlog.group(nodelist, bundler, reorder):
1992 yield chunk
2001 yield chunk
1993 yield bundler.close()
2002 yield bundler.close()
1994 self.ui.progress(_('bundling'), None)
2003 progress(_bundling, None)
1995
2004
1996 if nodes:
2005 if nodes:
1997 self.hook('outgoing', node=hex(nodes[0]), source=source)
2006 self.hook('outgoing', node=hex(nodes[0]), source=source)
General Comments 0
You need to be logged in to leave comments. Login now