Mercurial > hg
comparison mercurial/ancestor.py @ 39477:8eb2145ff0fb
ancestors: add nullrev to set from the beginning
Differential Revision: https://phab.mercurial-scm.org/D4507
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 07 Sep 2018 14:48:38 -0700 |
parents | 7eadc9407867 |
children | b6a0e06b0f7d |
comparison
equal
deleted
inserted
replaced
39476:7eadc9407867 | 39477:8eb2145ff0fb |
---|---|
309 revision number order. That order is also topological: a child is | 309 revision number order. That order is also topological: a child is |
310 always emitted before its parent. | 310 always emitted before its parent. |
311 | 311 |
312 If inclusive is True, the source revisions are also yielded. The | 312 If inclusive is True, the source revisions are also yielded. The |
313 reverse revision number order is still enforced.""" | 313 reverse revision number order is still enforced.""" |
314 seen = set() | 314 seen = {nullrev} |
315 revs = self._initrevs | 315 revs = self._initrevs |
316 | 316 |
317 parentrevs = self._parentrevs | 317 parentrevs = self._parentrevs |
318 stoprev = self._stoprev | 318 stoprev = self._stoprev |
319 schedule = heapq.heappush | 319 schedule = heapq.heappush |
320 nextitem = heapq.heappop | 320 nextitem = heapq.heappop |
321 see = seen.add | 321 see = seen.add |
322 see(nullrev) | |
323 | 322 |
324 if self._inclusive: | 323 if self._inclusive: |
325 visit = [-r for r in revs] | 324 visit = [-r for r in revs] |
326 seen.update(revs) | 325 seen.update(revs) |
327 heapq.heapify(visit) | 326 heapq.heapify(visit) |