Mercurial > public > mercurial-scm > hg-stable
comparison mercurial/debugcommands.py @ 51078:752e380c5702
debug-delta-chain: add options to control what we compute
Currently this mostly controls what we display, but actual computation saving
will come soon.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 19 Sep 2023 01:53:03 +0200 |
parents | 810446d2d5ef |
children | 2d30d1ba0371 |
comparison
equal
deleted
inserted
replaced
51077:810446d2d5ef | 51078:752e380c5702 |
---|---|
751 b'r', | 751 b'r', |
752 b'rev', | 752 b'rev', |
753 [], | 753 [], |
754 _('restrict processing to these revlog revisions'), | 754 _('restrict processing to these revlog revisions'), |
755 ), | 755 ), |
756 ( | |
757 b'', | |
758 b'size-info', | |
759 True, | |
760 _('compute information related to deltas size'), | |
761 ), | |
762 ( | |
763 b'', | |
764 b'dist-info', | |
765 True, | |
766 _('compute information related to base distance'), | |
767 ), | |
768 ( | |
769 b'', | |
770 b'sparse-info', | |
771 True, | |
772 _('compute information related to sparse read'), | |
773 ), | |
756 ] | 774 ] |
757 + cmdutil.debugrevlogopts | 775 + cmdutil.debugrevlogopts |
758 + cmdutil.formatteropts, | 776 + cmdutil.formatteropts, |
759 _(b'-c|-m|FILE'), | 777 _(b'-c|-m|FILE'), |
760 optionalrepo=True, | 778 optionalrepo=True, |
765 Output can be templatized. Available template keywords are: | 783 Output can be templatized. Available template keywords are: |
766 | 784 |
767 :``rev``: revision number | 785 :``rev``: revision number |
768 :``p1``: parent 1 revision number (for reference) | 786 :``p1``: parent 1 revision number (for reference) |
769 :``p2``: parent 2 revision number (for reference) | 787 :``p2``: parent 2 revision number (for reference) |
788 | |
770 :``chainid``: delta chain identifier (numbered by unique base) | 789 :``chainid``: delta chain identifier (numbered by unique base) |
771 :``chainlen``: delta chain length to this revision | 790 :``chainlen``: delta chain length to this revision |
791 | |
772 :``prevrev``: previous revision in delta chain | 792 :``prevrev``: previous revision in delta chain |
773 :``deltatype``: role of delta / how it was computed | 793 :``deltatype``: role of delta / how it was computed |
774 - base: a full snapshot | 794 - base: a full snapshot |
775 - snap: an intermediate snapshot | 795 - snap: an intermediate snapshot |
776 - p1: a delta against the first parent | 796 - p1: a delta against the first parent |
779 (when p1 has empty delta | 799 (when p1 has empty delta |
780 - skip2: a delta against the same base as p2 | 800 - skip2: a delta against the same base as p2 |
781 (when p2 has empty delta | 801 (when p2 has empty delta |
782 - prev: a delta against the previous revision | 802 - prev: a delta against the previous revision |
783 - other: a delta against an arbitrary revision | 803 - other: a delta against an arbitrary revision |
804 | |
784 :``compsize``: compressed size of revision | 805 :``compsize``: compressed size of revision |
785 :``uncompsize``: uncompressed size of revision | 806 :``uncompsize``: uncompressed size of revision |
786 :``chainsize``: total size of compressed revisions in chain | 807 :``chainsize``: total size of compressed revisions in chain |
787 :``chainratio``: total chain size divided by uncompressed revision size | 808 :``chainratio``: total chain size divided by uncompressed revision size |
788 (new delta chains typically start at ratio 2.00) | 809 (new delta chains typically start at ratio 2.00) |
810 | |
789 :``lindist``: linear distance from base revision in delta chain to end | 811 :``lindist``: linear distance from base revision in delta chain to end |
790 of this revision | 812 of this revision |
791 :``extradist``: total size of revisions not part of this delta chain from | 813 :``extradist``: total size of revisions not part of this delta chain from |
792 base of delta chain to end of this revision; a measurement | 814 base of delta chain to end of this revision; a measurement |
793 of how much extra data we need to read/seek across to read | 815 of how much extra data we need to read/seek across to read |
802 (sum of the sizes of all the blocks) | 824 (sum of the sizes of all the blocks) |
803 :``largestblock``: size of the largest block of data read from the disk | 825 :``largestblock``: size of the largest block of data read from the disk |
804 :``readdensity``: density of useful bytes in the data read from the disk | 826 :``readdensity``: density of useful bytes in the data read from the disk |
805 :``srchunks``: in how many data hunks the whole revision would be read | 827 :``srchunks``: in how many data hunks the whole revision would be read |
806 | 828 |
829 It is possible to select the information to be computed, this can provide a | |
830 noticeable speedup to the command in some cases. | |
831 | |
832 Always computed: | |
833 | |
834 - ``rev`` | |
835 - ``p1`` | |
836 - ``p2`` | |
837 - ``chainid`` | |
838 - ``chainlen`` | |
839 - ``prevrev`` | |
840 - ``deltatype`` | |
841 | |
842 Computed with --no-size-info | |
843 | |
844 - ``compsize`` | |
845 - ``uncompsize`` | |
846 - ``chainsize`` | |
847 - ``chainratio`` | |
848 | |
849 Computed with --no-dist-info | |
850 | |
851 - ``lindist`` | |
852 - ``extradist`` | |
853 - ``extraratio`` | |
854 | |
855 Skipped with --no-sparse-info | |
856 | |
857 - ``readsize`` | |
858 - ``largestblock`` | |
859 - ``readdensity`` | |
860 - ``srchunks`` | |
861 | |
862 -- | |
863 | |
807 The sparse read can be enabled with experimental.sparse-read = True | 864 The sparse read can be enabled with experimental.sparse-read = True |
808 """ | 865 """ |
809 revs = None | 866 revs = None |
810 revs_opt = opts.pop('rev', []) | 867 revs_opt = opts.pop('rev', []) |
811 if revs_opt: | 868 if revs_opt: |
812 revs = [int(r) for r in revs_opt] | 869 revs = [int(r) for r in revs_opt] |
870 | |
871 size_info = opts.pop('size_info', True) | |
872 dist_info = opts.pop('dist_info', True) | |
873 sparse_info = opts.pop('sparse_info', True) | |
874 | |
813 revlog = cmdutil.openrevlog( | 875 revlog = cmdutil.openrevlog( |
814 repo, b'debugdeltachain', file_, pycompat.byteskwargs(opts) | 876 repo, b'debugdeltachain', file_, pycompat.byteskwargs(opts) |
815 ) | 877 ) |
816 fm = ui.formatter(b'debugdeltachain', pycompat.byteskwargs(opts)) | 878 fm = ui.formatter(b'debugdeltachain', pycompat.byteskwargs(opts)) |
817 | 879 |
818 lines = revlog_debug.debug_delta_chain(revlog, revs=revs) | 880 lines = revlog_debug.debug_delta_chain( |
881 revlog, | |
882 revs=revs, | |
883 size_info=size_info, | |
884 dist_info=dist_info, | |
885 sparse_info=sparse_info, | |
886 ) | |
819 # first entry is the header | 887 # first entry is the header |
820 header = next(lines) | 888 header = next(lines) |
821 fm.plain(header) | 889 fm.plain(header) |
822 for entry in lines: | 890 for entry in lines: |
823 label = b' '.join(e[0] for e in entry) | 891 label = b' '.join(e[0] for e in entry) |