Show More
@@ -420,9 +420,6 b' class changelog(revlog.revlog):' | |||
|
420 | 420 | if i not in self.filteredrevs: |
|
421 | 421 | yield i |
|
422 | 422 | |
|
423 | def reachableroots(self, minroot, heads, roots, includepath=False): | |
|
424 | return self.index.reachableroots2(minroot, heads, roots, includepath) | |
|
425 | ||
|
426 | 423 | def _checknofilteredinrevs(self, revs): |
|
427 | 424 | """raise the appropriate error if 'revs' contains a filtered revision |
|
428 | 425 |
@@ -259,11 +259,10 b' def descendantrevs(revs, revsfn, parentr' | |||
|
259 | 259 | yield rev |
|
260 | 260 | break |
|
261 | 261 | |
|
262 |
def _reachablerootspure( |
|
|
263 | """See reachableroots""" | |
|
262 | def _reachablerootspure(pfunc, minroot, roots, heads, includepath): | |
|
263 | """See revlog.reachableroots""" | |
|
264 | 264 | if not roots: |
|
265 | 265 | return [] |
|
266 | parentrevs = repo.changelog.parentrevs | |
|
267 | 266 | roots = set(roots) |
|
268 | 267 | visit = list(heads) |
|
269 | 268 | reachable = set() |
@@ -280,7 +279,7 b' def _reachablerootspure(repo, minroot, r' | |||
|
280 | 279 | reached(rev) |
|
281 | 280 | if not includepath: |
|
282 | 281 | continue |
|
283 |
parents = p |
|
|
282 | parents = pfunc(rev) | |
|
284 | 283 | seen[rev] = parents |
|
285 | 284 | for parent in parents: |
|
286 | 285 | if parent >= minroot and parent not in seen: |
@@ -296,18 +295,13 b' def _reachablerootspure(repo, minroot, r' | |||
|
296 | 295 | return reachable |
|
297 | 296 | |
|
298 | 297 | def reachableroots(repo, roots, heads, includepath=False): |
|
299 | """return (heads(::<roots> and <roots>::<heads>)) | |
|
300 | ||
|
301 | If includepath is True, return (<roots>::<heads>).""" | |
|
298 | """See revlog.reachableroots""" | |
|
302 | 299 | if not roots: |
|
303 | 300 | return baseset() |
|
304 | 301 | minroot = roots.min() |
|
305 | 302 | roots = list(roots) |
|
306 | 303 | heads = list(heads) |
|
307 | try: | |
|
308 | revs = repo.changelog.reachableroots(minroot, heads, roots, includepath) | |
|
309 | except AttributeError: | |
|
310 | revs = _reachablerootspure(repo, minroot, roots, heads, includepath) | |
|
304 | revs = repo.changelog.reachableroots(minroot, heads, roots, includepath) | |
|
311 | 305 | revs = baseset(revs) |
|
312 | 306 | revs.sort() |
|
313 | 307 | return revs |
@@ -1216,14 +1216,25 b' class revlog(object):' | |||
|
1216 | 1216 | A revision is considered an ancestor of itself. |
|
1217 | 1217 | |
|
1218 | 1218 | The implementation of this is trivial but the use of |
|
1219 |
|
|
|
1219 | reachableroots is not.""" | |
|
1220 | 1220 | if a == nullrev: |
|
1221 | 1221 | return True |
|
1222 | 1222 | elif a == b: |
|
1223 | 1223 | return True |
|
1224 | 1224 | elif a > b: |
|
1225 | 1225 | return False |
|
1226 | return a in self._commonancestorsheads(a, b) | |
|
1226 | return bool(self.reachableroots(a, [b], [a], includepath=False)) | |
|
1227 | ||
|
1228 | def reachableroots(self, minroot, heads, roots, includepath=False): | |
|
1229 | """return (heads(::<roots> and <roots>::<heads>)) | |
|
1230 | ||
|
1231 | If includepath is True, return (<roots>::<heads>).""" | |
|
1232 | try: | |
|
1233 | return self.index.reachableroots2(minroot, heads, roots, | |
|
1234 | includepath) | |
|
1235 | except AttributeError: | |
|
1236 | return dagop._reachablerootspure(self.parentrevs, | |
|
1237 | minroot, roots, heads, includepath) | |
|
1227 | 1238 | |
|
1228 | 1239 | def ancestor(self, a, b): |
|
1229 | 1240 | """calculate the "best" common ancestor of nodes a and b""" |
General Comments 0
You need to be logged in to leave comments.
Login now