Show More
@@ -590,6 +590,20 b' def drop_u_compression(delta):' | |||||
590 | # consider these candidates. |
|
590 | # consider these candidates. | |
591 | LIMIT_BASE2TEXT = 500 |
|
591 | LIMIT_BASE2TEXT = 500 | |
592 |
|
592 | |||
|
593 | ### stage of the search, used for debug and to select and to adjust some logic. | |||
|
594 | # initial stage, next step is unknown | |||
|
595 | _STAGE_UNSPECIFIED = "unspecified" | |||
|
596 | # trying the cached delta | |||
|
597 | _STAGE_CACHED = "cached" | |||
|
598 | # trying delta based on parents | |||
|
599 | _STAGE_PARENTS = "parents" | |||
|
600 | # trying to build a valid snapshot of any level | |||
|
601 | _STAGE_SNAPSHOT = "snapshot" | |||
|
602 | # trying to build a delta based of the previous revision | |||
|
603 | _STAGE_PREV = "prev" | |||
|
604 | # trying to build a full snapshot | |||
|
605 | _STAGE_FULL = "full" | |||
|
606 | ||||
593 |
|
607 | |||
594 | class _BaseDeltaSearch(abc.ABC): |
|
608 | class _BaseDeltaSearch(abc.ABC): | |
595 | """perform the search of a good delta for a single revlog revision |
|
609 | """perform the search of a good delta for a single revlog revision | |
@@ -634,6 +648,7 b' class _BaseDeltaSearch(abc.ABC):' | |||||
634 |
|
648 | |||
635 | self.tested = {nullrev} |
|
649 | self.tested = {nullrev} | |
636 |
|
650 | |||
|
651 | self.current_stage = _STAGE_UNSPECIFIED | |||
637 | self.current_group = None |
|
652 | self.current_group = None | |
638 | self._init_group() |
|
653 | self._init_group() | |
639 |
|
654 | |||
@@ -790,7 +805,7 b' class _NoDeltaSearch(_BaseDeltaSearch):' | |||||
790 | """ |
|
805 | """ | |
791 |
|
806 | |||
792 | def _init_group(self): |
|
807 | def _init_group(self): | |
793 | pass |
|
808 | self.current_stage = _STAGE_FULL | |
794 |
|
809 | |||
795 | def next_group(self, good_delta=None): |
|
810 | def next_group(self, good_delta=None): | |
796 | pass |
|
811 | pass | |
@@ -804,9 +819,11 b' class _PrevDeltaSearch(_BaseDeltaSearch)' | |||||
804 | """ |
|
819 | """ | |
805 |
|
820 | |||
806 | def _init_group(self): |
|
821 | def _init_group(self): | |
|
822 | self.current_stage = _STAGE_PREV | |||
807 | self.current_group = [self.target_rev - 1] |
|
823 | self.current_group = [self.target_rev - 1] | |
808 |
|
824 | |||
809 | def next_group(self, good_delta=None): |
|
825 | def next_group(self, good_delta=None): | |
|
826 | self.current_stage = _STAGE_FULL | |||
810 | self.current_group = None |
|
827 | self.current_group = None | |
811 |
|
828 | |||
812 |
|
829 | |||
@@ -1026,6 +1043,7 b' class _DeltaSearch(_BaseDeltaSearch):' | |||||
1026 | ): |
|
1043 | ): | |
1027 | # Assume what we received from the server is a good choice |
|
1044 | # Assume what we received from the server is a good choice | |
1028 | # build delta will reuse the cache |
|
1045 | # build delta will reuse the cache | |
|
1046 | self.current_stage = _STAGE_CACHED | |||
1029 | good = yield (self.cachedelta[0],) |
|
1047 | good = yield (self.cachedelta[0],) | |
1030 | if good is not None: |
|
1048 | if good is not None: | |
1031 | yield None |
|
1049 | yield None | |
@@ -1039,6 +1057,7 b' class _DeltaSearch(_BaseDeltaSearch):' | |||||
1039 | # If sparse revlog is enabled, we can try to refine the available |
|
1057 | # If sparse revlog is enabled, we can try to refine the available | |
1040 | # deltas |
|
1058 | # deltas | |
1041 | if not self.revlog.delta_config.sparse_revlog: |
|
1059 | if not self.revlog.delta_config.sparse_revlog: | |
|
1060 | self.current_stage = _STAGE_FULL | |||
1042 | yield None |
|
1061 | yield None | |
1043 | return |
|
1062 | return | |
1044 |
|
1063 | |||
@@ -1048,6 +1067,7 b' class _DeltaSearch(_BaseDeltaSearch):' | |||||
1048 | and good not in (self.p1, self.p2) |
|
1067 | and good not in (self.p1, self.p2) | |
1049 | and self.revlog.issnapshot(good) |
|
1068 | and self.revlog.issnapshot(good) | |
1050 | ): |
|
1069 | ): | |
|
1070 | self.current_stage = _STAGE_SNAPSHOT | |||
1051 | # refine snapshot down |
|
1071 | # refine snapshot down | |
1052 | previous = None |
|
1072 | previous = None | |
1053 | while previous != good: |
|
1073 | while previous != good: | |
@@ -1067,6 +1087,7 b' class _DeltaSearch(_BaseDeltaSearch):' | |||||
1067 | ) |
|
1087 | ) | |
1068 | good = yield children |
|
1088 | good = yield children | |
1069 |
|
1089 | |||
|
1090 | self.current_stage = _STAGE_FULL | |||
1070 | yield None |
|
1091 | yield None | |
1071 |
|
1092 | |||
1072 | def _raw_groups(self): |
|
1093 | def _raw_groups(self): | |
@@ -1084,6 +1105,7 b' class _DeltaSearch(_BaseDeltaSearch):' | |||||
1084 | # exclude already lazy tested base if any |
|
1105 | # exclude already lazy tested base if any | |
1085 | parents = [p for p in (self.p1, self.p2) if p != nullrev] |
|
1106 | parents = [p for p in (self.p1, self.p2) if p != nullrev] | |
1086 |
|
1107 | |||
|
1108 | self.current_stage = _STAGE_PARENTS | |||
1087 | if ( |
|
1109 | if ( | |
1088 | not self.revlog.delta_config.delta_both_parents |
|
1110 | not self.revlog.delta_config.delta_both_parents | |
1089 | and len(parents) == 2 |
|
1111 | and len(parents) == 2 | |
@@ -1099,6 +1121,7 b' class _DeltaSearch(_BaseDeltaSearch):' | |||||
1099 | yield parents |
|
1121 | yield parents | |
1100 |
|
1122 | |||
1101 | if sparse and parents: |
|
1123 | if sparse and parents: | |
|
1124 | self.current_stage = _STAGE_SNAPSHOT | |||
1102 | # See if we can use an existing snapshot in the parent chains to |
|
1125 | # See if we can use an existing snapshot in the parent chains to | |
1103 | # use as a base for a new intermediate-snapshot |
|
1126 | # use as a base for a new intermediate-snapshot | |
1104 | # |
|
1127 | # | |
@@ -1188,6 +1211,7 b' class _DeltaSearch(_BaseDeltaSearch):' | |||||
1188 | if not sparse: |
|
1211 | if not sparse: | |
1189 | # other approach failed try against prev to hopefully save us a |
|
1212 | # other approach failed try against prev to hopefully save us a | |
1190 | # fulltext. |
|
1213 | # fulltext. | |
|
1214 | self.current_stage = _STAGE_PREV | |||
1191 | yield (prev,) |
|
1215 | yield (prev,) | |
1192 |
|
1216 | |||
1193 |
|
1217 |
General Comments 0
You need to be logged in to leave comments.
Login now