Show More
@@ -1137,21 +1137,21 b' class revlog(object):' | |||||
1137 | self._cache = (node, curr, text) |
|
1137 | self._cache = (node, curr, text) | |
1138 | return node |
|
1138 | return node | |
1139 |
|
1139 | |||
1140 |
def descendant(self, a, |
|
1140 | def descendant(self, start, end): | |
1141 | if a > b: |
|
1141 | for i in self.descendants(start): | |
1142 | return False |
|
1142 | if i == end: | |
1143 | for i in self.descendants(a): |
|
|||
1144 | if i == b: |
|
|||
1145 | return True |
|
1143 | return True | |
1146 |
elif i > |
|
1144 | elif i > end: | |
1147 | break |
|
1145 | break | |
1148 | return False |
|
1146 | return False | |
1149 |
|
1147 | |||
1150 | def ancestor(self, a, b): |
|
1148 | def ancestor(self, a, b): | |
1151 | """calculate the least common ancestor of nodes a and b""" |
|
1149 | """calculate the least common ancestor of nodes a and b""" | |
1152 |
|
1150 | |||
|
1151 | # fast path, check if it is a descendant | |||
|
1152 | a, b = self.rev(a), self.rev(b) | |||
1153 | start, end = sorted((a, b)) |
|
1153 | start, end = sorted((a, b)) | |
1154 |
if self.descendant(a, |
|
1154 | if self.descendant(start, end): | |
1155 | return self.node(start) |
|
1155 | return self.node(start) | |
1156 |
|
1156 | |||
1157 | def parents(rev): |
|
1157 | def parents(rev): |
General Comments 0
You need to be logged in to leave comments.
Login now