Show More
@@ -1858,107 +1858,6 b' def copy(ui, repo, *pats, **opts):' | |||
|
1858 | 1858 | with repo.wlock(False): |
|
1859 | 1859 | return cmdutil.copy(ui, repo, pats, opts) |
|
1860 | 1860 | |
|
1861 | @command('debugdeltachain', | |
|
1862 | debugrevlogopts + formatteropts, | |
|
1863 | _('-c|-m|FILE'), | |
|
1864 | optionalrepo=True) | |
|
1865 | def debugdeltachain(ui, repo, file_=None, **opts): | |
|
1866 | """dump information about delta chains in a revlog | |
|
1867 | ||
|
1868 | Output can be templatized. Available template keywords are: | |
|
1869 | ||
|
1870 | :``rev``: revision number | |
|
1871 | :``chainid``: delta chain identifier (numbered by unique base) | |
|
1872 | :``chainlen``: delta chain length to this revision | |
|
1873 | :``prevrev``: previous revision in delta chain | |
|
1874 | :``deltatype``: role of delta / how it was computed | |
|
1875 | :``compsize``: compressed size of revision | |
|
1876 | :``uncompsize``: uncompressed size of revision | |
|
1877 | :``chainsize``: total size of compressed revisions in chain | |
|
1878 | :``chainratio``: total chain size divided by uncompressed revision size | |
|
1879 | (new delta chains typically start at ratio 2.00) | |
|
1880 | :``lindist``: linear distance from base revision in delta chain to end | |
|
1881 | of this revision | |
|
1882 | :``extradist``: total size of revisions not part of this delta chain from | |
|
1883 | base of delta chain to end of this revision; a measurement | |
|
1884 | of how much extra data we need to read/seek across to read | |
|
1885 | the delta chain for this revision | |
|
1886 | :``extraratio``: extradist divided by chainsize; another representation of | |
|
1887 | how much unrelated data is needed to load this delta chain | |
|
1888 | """ | |
|
1889 | r = cmdutil.openrevlog(repo, 'debugdeltachain', file_, opts) | |
|
1890 | index = r.index | |
|
1891 | generaldelta = r.version & revlog.REVLOGGENERALDELTA | |
|
1892 | ||
|
1893 | def revinfo(rev): | |
|
1894 | e = index[rev] | |
|
1895 | compsize = e[1] | |
|
1896 | uncompsize = e[2] | |
|
1897 | chainsize = 0 | |
|
1898 | ||
|
1899 | if generaldelta: | |
|
1900 | if e[3] == e[5]: | |
|
1901 | deltatype = 'p1' | |
|
1902 | elif e[3] == e[6]: | |
|
1903 | deltatype = 'p2' | |
|
1904 | elif e[3] == rev - 1: | |
|
1905 | deltatype = 'prev' | |
|
1906 | elif e[3] == rev: | |
|
1907 | deltatype = 'base' | |
|
1908 | else: | |
|
1909 | deltatype = 'other' | |
|
1910 | else: | |
|
1911 | if e[3] == rev: | |
|
1912 | deltatype = 'base' | |
|
1913 | else: | |
|
1914 | deltatype = 'prev' | |
|
1915 | ||
|
1916 | chain = r._deltachain(rev)[0] | |
|
1917 | for iterrev in chain: | |
|
1918 | e = index[iterrev] | |
|
1919 | chainsize += e[1] | |
|
1920 | ||
|
1921 | return compsize, uncompsize, deltatype, chain, chainsize | |
|
1922 | ||
|
1923 | fm = ui.formatter('debugdeltachain', opts) | |
|
1924 | ||
|
1925 | fm.plain(' rev chain# chainlen prev delta ' | |
|
1926 | 'size rawsize chainsize ratio lindist extradist ' | |
|
1927 | 'extraratio\n') | |
|
1928 | ||
|
1929 | chainbases = {} | |
|
1930 | for rev in r: | |
|
1931 | comp, uncomp, deltatype, chain, chainsize = revinfo(rev) | |
|
1932 | chainbase = chain[0] | |
|
1933 | chainid = chainbases.setdefault(chainbase, len(chainbases) + 1) | |
|
1934 | basestart = r.start(chainbase) | |
|
1935 | revstart = r.start(rev) | |
|
1936 | lineardist = revstart + comp - basestart | |
|
1937 | extradist = lineardist - chainsize | |
|
1938 | try: | |
|
1939 | prevrev = chain[-2] | |
|
1940 | except IndexError: | |
|
1941 | prevrev = -1 | |
|
1942 | ||
|
1943 | chainratio = float(chainsize) / float(uncomp) | |
|
1944 | extraratio = float(extradist) / float(chainsize) | |
|
1945 | ||
|
1946 | fm.startitem() | |
|
1947 | fm.write('rev chainid chainlen prevrev deltatype compsize ' | |
|
1948 | 'uncompsize chainsize chainratio lindist extradist ' | |
|
1949 | 'extraratio', | |
|
1950 | '%7d %7d %8d %8d %7s %10d %10d %10d %9.5f %9d %9d %10.5f\n', | |
|
1951 | rev, chainid, len(chain), prevrev, deltatype, comp, | |
|
1952 | uncomp, chainsize, chainratio, lineardist, extradist, | |
|
1953 | extraratio, | |
|
1954 | rev=rev, chainid=chainid, chainlen=len(chain), | |
|
1955 | prevrev=prevrev, deltatype=deltatype, compsize=comp, | |
|
1956 | uncompsize=uncomp, chainsize=chainsize, | |
|
1957 | chainratio=chainratio, lindist=lineardist, | |
|
1958 | extradist=extradist, extraratio=extraratio) | |
|
1959 | ||
|
1960 | fm.end() | |
|
1961 | ||
|
1962 | 1861 | @command('debuginstall', [] + formatteropts, '', norepo=True) |
|
1963 | 1862 | def debuginstall(ui, **opts): |
|
1964 | 1863 | '''test Mercurial installation |
@@ -748,3 +748,104 b' def debugindexdot(ui, repo, file_=None, ' | |||
|
748 | 748 | if pp[1] != nullid: |
|
749 | 749 | ui.write("\t%d -> %d\n" % (r.rev(pp[1]), i)) |
|
750 | 750 | ui.write("}\n") |
|
751 | ||
|
752 | @command('debugdeltachain', | |
|
753 | commands.debugrevlogopts + commands.formatteropts, | |
|
754 | _('-c|-m|FILE'), | |
|
755 | optionalrepo=True) | |
|
756 | def debugdeltachain(ui, repo, file_=None, **opts): | |
|
757 | """dump information about delta chains in a revlog | |
|
758 | ||
|
759 | Output can be templatized. Available template keywords are: | |
|
760 | ||
|
761 | :``rev``: revision number | |
|
762 | :``chainid``: delta chain identifier (numbered by unique base) | |
|
763 | :``chainlen``: delta chain length to this revision | |
|
764 | :``prevrev``: previous revision in delta chain | |
|
765 | :``deltatype``: role of delta / how it was computed | |
|
766 | :``compsize``: compressed size of revision | |
|
767 | :``uncompsize``: uncompressed size of revision | |
|
768 | :``chainsize``: total size of compressed revisions in chain | |
|
769 | :``chainratio``: total chain size divided by uncompressed revision size | |
|
770 | (new delta chains typically start at ratio 2.00) | |
|
771 | :``lindist``: linear distance from base revision in delta chain to end | |
|
772 | of this revision | |
|
773 | :``extradist``: total size of revisions not part of this delta chain from | |
|
774 | base of delta chain to end of this revision; a measurement | |
|
775 | of how much extra data we need to read/seek across to read | |
|
776 | the delta chain for this revision | |
|
777 | :``extraratio``: extradist divided by chainsize; another representation of | |
|
778 | how much unrelated data is needed to load this delta chain | |
|
779 | """ | |
|
780 | r = cmdutil.openrevlog(repo, 'debugdeltachain', file_, opts) | |
|
781 | index = r.index | |
|
782 | generaldelta = r.version & revlog.REVLOGGENERALDELTA | |
|
783 | ||
|
784 | def revinfo(rev): | |
|
785 | e = index[rev] | |
|
786 | compsize = e[1] | |
|
787 | uncompsize = e[2] | |
|
788 | chainsize = 0 | |
|
789 | ||
|
790 | if generaldelta: | |
|
791 | if e[3] == e[5]: | |
|
792 | deltatype = 'p1' | |
|
793 | elif e[3] == e[6]: | |
|
794 | deltatype = 'p2' | |
|
795 | elif e[3] == rev - 1: | |
|
796 | deltatype = 'prev' | |
|
797 | elif e[3] == rev: | |
|
798 | deltatype = 'base' | |
|
799 | else: | |
|
800 | deltatype = 'other' | |
|
801 | else: | |
|
802 | if e[3] == rev: | |
|
803 | deltatype = 'base' | |
|
804 | else: | |
|
805 | deltatype = 'prev' | |
|
806 | ||
|
807 | chain = r._deltachain(rev)[0] | |
|
808 | for iterrev in chain: | |
|
809 | e = index[iterrev] | |
|
810 | chainsize += e[1] | |
|
811 | ||
|
812 | return compsize, uncompsize, deltatype, chain, chainsize | |
|
813 | ||
|
814 | fm = ui.formatter('debugdeltachain', opts) | |
|
815 | ||
|
816 | fm.plain(' rev chain# chainlen prev delta ' | |
|
817 | 'size rawsize chainsize ratio lindist extradist ' | |
|
818 | 'extraratio\n') | |
|
819 | ||
|
820 | chainbases = {} | |
|
821 | for rev in r: | |
|
822 | comp, uncomp, deltatype, chain, chainsize = revinfo(rev) | |
|
823 | chainbase = chain[0] | |
|
824 | chainid = chainbases.setdefault(chainbase, len(chainbases) + 1) | |
|
825 | basestart = r.start(chainbase) | |
|
826 | revstart = r.start(rev) | |
|
827 | lineardist = revstart + comp - basestart | |
|
828 | extradist = lineardist - chainsize | |
|
829 | try: | |
|
830 | prevrev = chain[-2] | |
|
831 | except IndexError: | |
|
832 | prevrev = -1 | |
|
833 | ||
|
834 | chainratio = float(chainsize) / float(uncomp) | |
|
835 | extraratio = float(extradist) / float(chainsize) | |
|
836 | ||
|
837 | fm.startitem() | |
|
838 | fm.write('rev chainid chainlen prevrev deltatype compsize ' | |
|
839 | 'uncompsize chainsize chainratio lindist extradist ' | |
|
840 | 'extraratio', | |
|
841 | '%7d %7d %8d %8d %7s %10d %10d %10d %9.5f %9d %9d %10.5f\n', | |
|
842 | rev, chainid, len(chain), prevrev, deltatype, comp, | |
|
843 | uncomp, chainsize, chainratio, lineardist, extradist, | |
|
844 | extraratio, | |
|
845 | rev=rev, chainid=chainid, chainlen=len(chain), | |
|
846 | prevrev=prevrev, deltatype=deltatype, compsize=comp, | |
|
847 | uncompsize=uncomp, chainsize=chainsize, | |
|
848 | chainratio=chainratio, lindist=lineardist, | |
|
849 | extradist=extradist, extraratio=extraratio) | |
|
850 | ||
|
851 | fm.end() |
General Comments 0
You need to be logged in to leave comments.
Login now