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