Mercurial > public > mercurial-scm > hg
comparison mercurial/ancestor.py @ 39533:f6bcb4f9cd3c
ancestor: remove alias of initrevs from _lazyancestorsiter()
It's just redundant and less comprehensible.
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Tue, 11 Sep 2018 22:38:32 +0900 |
parents | 77a2f6d805f2 |
children | fd9029d36c41 |
comparison
equal
deleted
inserted
replaced
39532:55eea29833d2 | 39533:f6bcb4f9cd3c |
---|---|
260 return missing | 260 return missing |
261 | 261 |
262 # Extracted from lazyancestors.__iter__ to avoid a reference cycle | 262 # Extracted from lazyancestors.__iter__ to avoid a reference cycle |
263 def _lazyancestorsiter(parentrevs, initrevs, stoprev, inclusive): | 263 def _lazyancestorsiter(parentrevs, initrevs, stoprev, inclusive): |
264 seen = {nullrev} | 264 seen = {nullrev} |
265 revs = initrevs | |
266 | |
267 schedule = heapq.heappush | 265 schedule = heapq.heappush |
268 nextitem = heapq.heappop | 266 nextitem = heapq.heappop |
269 see = seen.add | 267 see = seen.add |
270 | 268 |
271 if inclusive: | 269 if inclusive: |
272 visit = [-r for r in revs] | 270 visit = [-r for r in initrevs] |
273 seen.update(revs) | 271 seen.update(initrevs) |
274 heapq.heapify(visit) | 272 heapq.heapify(visit) |
275 else: | 273 else: |
276 visit = [] | 274 visit = [] |
277 heapq.heapify(visit) | 275 heapq.heapify(visit) |
278 for r in revs: | 276 for r in initrevs: |
279 for parent in parentrevs(r): | 277 for parent in parentrevs(r): |
280 if parent not in seen: | 278 if parent not in seen: |
281 schedule(visit, -parent) | 279 schedule(visit, -parent) |
282 see(parent) | 280 see(parent) |
283 | 281 |