Show More
@@ -768,6 +768,10 b' def debugdeltachain(ui, repo, file_=None' | |||
|
768 | 768 | - snap: an intermediate snapshot |
|
769 | 769 | - p1: a delta against the first parent |
|
770 | 770 | - p2: a delta against the second parent |
|
771 | - skip1: a delta against the same base as p1 | |
|
772 | (when p1 has empty delta | |
|
773 | - skip2: a delta against the same base as p2 | |
|
774 | (when p2 has empty delta | |
|
771 | 775 | - prev: a delta against the previous revision |
|
772 | 776 | - other: a delta against an arbitrary revision |
|
773 | 777 | :``compsize``: compressed size of revision |
@@ -803,6 +807,9 b' def debugdeltachain(ui, repo, file_=None' | |||
|
803 | 807 | generaldelta = r._generaldelta |
|
804 | 808 | withsparseread = getattr(r, '_withsparseread', False) |
|
805 | 809 | |
|
810 | # security to avoid crash on corrupted revlogs | |
|
811 | total_revs = len(index) | |
|
812 | ||
|
806 | 813 | def revinfo(rev): |
|
807 | 814 | e = index[rev] |
|
808 | 815 | compsize = e[revlog_constants.ENTRY_DATA_COMPRESSED_LENGTH] |
@@ -813,6 +820,39 b' def debugdeltachain(ui, repo, file_=None' | |||
|
813 | 820 | p1 = e[revlog_constants.ENTRY_PARENT_1] |
|
814 | 821 | p2 = e[revlog_constants.ENTRY_PARENT_2] |
|
815 | 822 | |
|
823 | # If the parents of a revision has an empty delta, we never try to delta | |
|
824 | # against that parent, but directly against the delta base of that | |
|
825 | # parent (recursively). It avoids adding a useless entry in the chain. | |
|
826 | # | |
|
827 | # However we need to detect that as a special case for delta-type, that | |
|
828 | # is not simply "other". | |
|
829 | p1_base = p1 | |
|
830 | if p1 != nullrev and p1 < total_revs: | |
|
831 | e1 = index[p1] | |
|
832 | while e1[revlog_constants.ENTRY_DATA_COMPRESSED_LENGTH] == 0: | |
|
833 | new_base = e1[revlog_constants.ENTRY_DELTA_BASE] | |
|
834 | if ( | |
|
835 | new_base == p1_base | |
|
836 | or new_base == nullrev | |
|
837 | or new_base >= total_revs | |
|
838 | ): | |
|
839 | break | |
|
840 | p1_base = new_base | |
|
841 | e1 = index[p1_base] | |
|
842 | p2_base = p2 | |
|
843 | if p2 != nullrev and p2 < total_revs: | |
|
844 | e2 = index[p2] | |
|
845 | while e2[revlog_constants.ENTRY_DATA_COMPRESSED_LENGTH] == 0: | |
|
846 | new_base = e2[revlog_constants.ENTRY_DELTA_BASE] | |
|
847 | if ( | |
|
848 | new_base == p2_base | |
|
849 | or new_base == nullrev | |
|
850 | or new_base >= total_revs | |
|
851 | ): | |
|
852 | break | |
|
853 | p2_base = new_base | |
|
854 | e2 = index[p2_base] | |
|
855 | ||
|
816 | 856 | if generaldelta: |
|
817 | 857 | if base == p1: |
|
818 | 858 | deltatype = b'p1' |
@@ -820,6 +860,10 b' def debugdeltachain(ui, repo, file_=None' | |||
|
820 | 860 | deltatype = b'p2' |
|
821 | 861 | elif base == rev: |
|
822 | 862 | deltatype = b'base' |
|
863 | elif base == p1_base: | |
|
864 | deltatype = b'skip1' | |
|
865 | elif base == p2_base: | |
|
866 | deltatype = b'skip2' | |
|
823 | 867 | elif r.issnapshot(rev): |
|
824 | 868 | deltatype = b'snap' |
|
825 | 869 | elif base == rev - 1: |
General Comments 0
You need to be logged in to leave comments.
Login now