1053 if not self._pre_filter_rev_sparse(rev): |
1053 if not self._pre_filter_rev_sparse(rev): |
1054 return False |
1054 return False |
1055 |
1055 |
1056 return True |
1056 return True |
1057 |
1057 |
|
1058 def _iter_parents(self): |
|
1059 # exclude already lazy tested base if any |
|
1060 parents = [p for p in (self.p1, self.p2) if p != nullrev] |
|
1061 |
|
1062 self.current_stage = _STAGE_PARENTS |
|
1063 if ( |
|
1064 not self.revlog.delta_config.delta_both_parents |
|
1065 and len(parents) == 2 |
|
1066 ): |
|
1067 parents.sort() |
|
1068 # To minimize the chance of having to build a fulltext, |
|
1069 # pick first whichever parent is closest to us (max rev) |
|
1070 yield (parents[1],) |
|
1071 # then the other one (min rev) if the first did not fit |
|
1072 yield (parents[0],) |
|
1073 elif len(parents) > 0: |
|
1074 # Test all parents (1 or 2), and keep the best candidate |
|
1075 yield parents |
|
1076 |
1058 def _refined_groups(self): |
1077 def _refined_groups(self): |
1059 good = None |
1078 good = None |
1060 groups = self._raw_groups() |
1079 groups = self._raw_groups() |
1061 for candidates in groups: |
1080 for candidates in groups: |
1062 good = yield candidates |
1081 good = yield candidates |
1105 This lower level function focus on emitting delta theorically |
1124 This lower level function focus on emitting delta theorically |
1106 interresting without looking it any practical details. |
1125 interresting without looking it any practical details. |
1107 |
1126 |
1108 The group order aims at providing fast or small candidates first. |
1127 The group order aims at providing fast or small candidates first. |
1109 """ |
1128 """ |
|
1129 yield from self._iter_parents() |
1110 sparse = self.revlog.delta_config.sparse_revlog |
1130 sparse = self.revlog.delta_config.sparse_revlog |
1111 prev = self.target_rev - 1 |
1131 prev = self.target_rev - 1 |
1112 deltachain = lambda rev: self.revlog._deltachain(rev)[0] |
1132 deltachain = lambda rev: self.revlog._deltachain(rev)[0] |
1113 |
1133 |
1114 # exclude already lazy tested base if any |
|
1115 parents = [p for p in (self.p1, self.p2) if p != nullrev] |
1134 parents = [p for p in (self.p1, self.p2) if p != nullrev] |
1116 |
|
1117 self.current_stage = _STAGE_PARENTS |
|
1118 if ( |
|
1119 not self.revlog.delta_config.delta_both_parents |
|
1120 and len(parents) == 2 |
|
1121 ): |
|
1122 parents.sort() |
|
1123 # To minimize the chance of having to build a fulltext, |
|
1124 # pick first whichever parent is closest to us (max rev) |
|
1125 yield (parents[1],) |
|
1126 # then the other one (min rev) if the first did not fit |
|
1127 yield (parents[0],) |
|
1128 elif len(parents) > 0: |
|
1129 # Test all parents (1 or 2), and keep the best candidate |
|
1130 yield parents |
|
1131 |
|
1132 if sparse and parents: |
1135 if sparse and parents: |
1133 self.current_stage = _STAGE_SNAPSHOT |
1136 self.current_stage = _STAGE_SNAPSHOT |
1134 # See if we can use an existing snapshot in the parent chains to |
1137 # See if we can use an existing snapshot in the parent chains to |
1135 # use as a base for a new intermediate-snapshot |
1138 # use as a base for a new intermediate-snapshot |
1136 # |
1139 # |