Details
Details
- Reviewers
- None
- Group Reviewers
hg-reviewers - Commits
- rHG8eb2145ff0fb: ancestors: add nullrev to set from the beginning
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/ancestor.py (3 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
Martin von Zweigbergk | Sep 7 2018, 5:48 PM |
Status | Author | Revision | |
---|---|---|---|
Closed | martinvonz | ||
Closed | martinvonz |
If inclusive is False, yield a sequence of revision numbers starting | If inclusive is False, yield a sequence of revision numbers starting | ||||
with the parents of each revision in revs, i.e., each revision is | with the parents of each revision in revs, i.e., each revision is | ||||
*not* considered an ancestor of itself. Results are emitted in reverse | *not* considered an ancestor of itself. Results are emitted in reverse | ||||
revision number order. That order is also topological: a child is | revision number order. That order is also topological: a child is | ||||
always emitted before its parent. | always emitted before its parent. | ||||
If inclusive is True, the source revisions are also yielded. The | If inclusive is True, the source revisions are also yielded. The | ||||
reverse revision number order is still enforced.""" | reverse revision number order is still enforced.""" | ||||
seen = set() | seen = {nullrev} | ||||
revs = self._initrevs | revs = self._initrevs | ||||
parentrevs = self._parentrevs | parentrevs = self._parentrevs | ||||
stoprev = self._stoprev | stoprev = self._stoprev | ||||
schedule = heapq.heappush | schedule = heapq.heappush | ||||
nextitem = heapq.heappop | nextitem = heapq.heappop | ||||
see = seen.add | see = seen.add | ||||
see(nullrev) | |||||
if self._inclusive: | if self._inclusive: | ||||
visit = [-r for r in revs] | visit = [-r for r in revs] | ||||
seen.update(revs) | seen.update(revs) | ||||
heapq.heapify(visit) | heapq.heapify(visit) | ||||
else: | else: | ||||
visit = [] | visit = [] | ||||
heapq.heapify(visit) | heapq.heapify(visit) |