Show More
@@ -283,14 +283,22 b' def _lazyancestorsiter(parentrevs, initr' | |||
|
283 | 283 | see(p2) |
|
284 | 284 | |
|
285 | 285 | while visit: |
|
286 |
current = - |
|
|
286 | current = -visit[0] | |
|
287 | 287 | if current < stoprev: |
|
288 | 288 | break |
|
289 | 289 | yield current |
|
290 | # optimize out heapq operation if p1 is known to be the next highest | |
|
291 | # revision, which is quite common in linear history. | |
|
290 | 292 | p1, p2 = parentrevs(current) |
|
291 | 293 | if p1 not in seen: |
|
292 | schedule(visit, -p1) | |
|
294 | if current - p1 == 1: | |
|
295 | visit[0] = -p1 | |
|
296 | else: | |
|
297 | nextitem(visit) | |
|
298 | schedule(visit, -p1) | |
|
293 | 299 | see(p1) |
|
300 | else: | |
|
301 | nextitem(visit) | |
|
294 | 302 | if p2 not in seen: |
|
295 | 303 | schedule(visit, -p2) |
|
296 | 304 | see(p2) |
@@ -221,6 +221,10 b' def test_lazyancestors():' | |||
|
221 | 221 | s = genlazyancestors([11, 13], stoprev=12, inclusive=True) |
|
222 | 222 | printlazyancestors(s, [11, 13, 7, 9, 8, 3, 6, 4, 1, -1, 0]) |
|
223 | 223 | |
|
224 | # Contiguous chains: 5->4, 2->1 (where 1 is in seen set), 1->0 | |
|
225 | s = genlazyancestors([10, 1], inclusive=True) | |
|
226 | printlazyancestors(s, [2, 10, 4, 5, -1, 0, 1]) | |
|
227 | ||
|
224 | 228 | # The C gca algorithm requires a real repo. These are textual descriptions of |
|
225 | 229 | # DAGs that have been known to be problematic, and, optionally, known pairs |
|
226 | 230 | # of revisions and their expected ancestor list. |
General Comments 0
You need to be logged in to leave comments.
Login now