Show More
@@ -1056,6 +1056,18 b' class _spanset(abstractsmartset):' | |||||
1056 | return x |
|
1056 | return x | |
1057 | return None |
|
1057 | return None | |
1058 |
|
1058 | |||
|
1059 | def _slice(self, start, stop): | |||
|
1060 | if self._hiddenrevs: | |||
|
1061 | # unoptimized since all hidden revisions in range has to be scanned | |||
|
1062 | return super(_spanset, self)._slice(start, stop) | |||
|
1063 | if self._ascending: | |||
|
1064 | x = min(self._start + start, self._end) | |||
|
1065 | y = min(self._start + stop, self._end) | |||
|
1066 | else: | |||
|
1067 | x = max(self._end - stop, self._start) | |||
|
1068 | y = max(self._end - start, self._start) | |||
|
1069 | return _spanset(x, y, self._ascending, self._hiddenrevs) | |||
|
1070 | ||||
1059 | def __repr__(self): |
|
1071 | def __repr__(self): | |
1060 | d = {False: '-', True: '+'}[self._ascending] |
|
1072 | d = {False: '-', True: '+'}[self._ascending] | |
1061 | return '<%s%s %d:%d>' % (type(self).__name__.lstrip('_'), d, |
|
1073 | return '<%s%s %d:%d>' % (type(self).__name__.lstrip('_'), d, |
@@ -1080,13 +1080,54 b' Test smartset.slice() by first/last()' | |||||
1080 | * set: |
|
1080 | * set: | |
1081 | <baseset+ []> |
|
1081 | <baseset+ []> | |
1082 |
|
1082 | |||
|
1083 | (using spanset) | |||
|
1084 | ||||
|
1085 | $ hg debugrevspec --no-show-revs -s 0:7 | |||
|
1086 | * set: | |||
|
1087 | <spanset+ 0:8> | |||
|
1088 | $ log 'limit(0:7, 3, 4)' | |||
|
1089 | 4 | |||
|
1090 | 5 | |||
|
1091 | 6 | |||
|
1092 | $ log 'limit(7:0, 3, 4)' | |||
|
1093 | 3 | |||
|
1094 | 2 | |||
|
1095 | 1 | |||
|
1096 | $ log 'limit(0:7, 3, 6)' | |||
|
1097 | 6 | |||
|
1098 | 7 | |||
|
1099 | $ log 'limit(7:0, 3, 6)' | |||
|
1100 | 1 | |||
|
1101 | 0 | |||
|
1102 | $ log 'last(0:7, 2)' | |||
|
1103 | 6 | |||
|
1104 | 7 | |||
|
1105 | $ hg debugrevspec -s 'limit(0:7, 3, 6)' | |||
|
1106 | * set: | |||
|
1107 | <spanset+ 6:8> | |||
|
1108 | 6 | |||
|
1109 | 7 | |||
|
1110 | $ hg debugrevspec -s 'limit(0:7, 3, 9)' | |||
|
1111 | * set: | |||
|
1112 | <spanset+ 8:8> | |||
|
1113 | $ hg debugrevspec -s 'limit(7:0, 3, 6)' | |||
|
1114 | * set: | |||
|
1115 | <spanset- 0:2> | |||
|
1116 | 1 | |||
|
1117 | 0 | |||
|
1118 | $ hg debugrevspec -s 'limit(7:0, 3, 9)' | |||
|
1119 | * set: | |||
|
1120 | <spanset- 0:0> | |||
|
1121 | $ hg debugrevspec -s 'limit(0:7, 0)' | |||
|
1122 | * set: | |||
|
1123 | <spanset+ 0:0> | |||
|
1124 | ||||
1083 | Test order of first/last revisions |
|
1125 | Test order of first/last revisions | |
1084 |
|
1126 | |||
1085 | $ hg debugrevspec -s 'first(4:0, 3) & 3:' |
|
1127 | $ hg debugrevspec -s 'first(4:0, 3) & 3:' | |
1086 | * set: |
|
1128 | * set: | |
1087 | <filteredset |
|
1129 | <filteredset | |
1088 | <baseset slice=0:3 |
|
1130 | <spanset- 2:5>, | |
1089 | <spanset- 0:5>>, |
|
|||
1090 | <spanset+ 3:10>> |
|
1131 | <spanset+ 3:10>> | |
1091 | 4 |
|
1132 | 4 | |
1092 | 3 |
|
1133 | 3 | |
@@ -1095,16 +1136,14 b' Test order of first/last revisions' | |||||
1095 | * set: |
|
1136 | * set: | |
1096 | <filteredset |
|
1137 | <filteredset | |
1097 | <spanset+ 3:10>, |
|
1138 | <spanset+ 3:10>, | |
1098 | <baseset slice=0:3 |
|
1139 | <spanset- 2:5>> | |
1099 | <spanset- 0:5>>> |
|
|||
1100 | 3 |
|
1140 | 3 | |
1101 | 4 |
|
1141 | 4 | |
1102 |
|
1142 | |||
1103 | $ hg debugrevspec -s 'last(4:0, 3) & :1' |
|
1143 | $ hg debugrevspec -s 'last(4:0, 3) & :1' | |
1104 | * set: |
|
1144 | * set: | |
1105 | <filteredset |
|
1145 | <filteredset | |
1106 |
< |
|
1146 | <spanset- 0:3>, | |
1107 | <spanset+ 0:5>>, |
|
|||
1108 | <spanset+ 0:2>> |
|
1147 | <spanset+ 0:2>> | |
1109 | 1 |
|
1148 | 1 | |
1110 | 0 |
|
1149 | 0 | |
@@ -1113,8 +1152,7 b' Test order of first/last revisions' | |||||
1113 | * set: |
|
1152 | * set: | |
1114 | <filteredset |
|
1153 | <filteredset | |
1115 | <spanset+ 0:2>, |
|
1154 | <spanset+ 0:2>, | |
1116 |
< |
|
1155 | <spanset+ 0:3>> | |
1117 | <spanset+ 0:5>>> |
|
|||
1118 | 0 |
|
1156 | 0 | |
1119 | 1 |
|
1157 | 1 | |
1120 |
|
1158 |
General Comments 0
You need to be logged in to leave comments.
Login now