Mercurial > hg
changeset 24938:6db8074f9150
revset: return early when revs is empty
By introducing an early return in _revancestors() when revs is empty,
we make it so inputrev is never None, which simplifies the subsequent
code.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Wed, 06 May 2015 11:29:09 -0700 |
parents | f5518b47cdd1 |
children | 85544a52ee84 |
files | mercurial/revset.py |
diffstat | 1 files changed, 7 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/revset.py Wed Mar 26 16:14:30 2014 -0700 +++ b/mercurial/revset.py Wed May 06 11:29:09 2015 -0700 @@ -25,20 +25,20 @@ cl = repo.changelog def iterate(): - revqueue, inputrev = None, None - h = [] - revs.sort(reverse=True) revqueue = util.deque(revs) - if revqueue: - inputrev = revqueue.popleft() - heapq.heappush(h, -inputrev) + if not revqueue: + return + + h = [] + inputrev = revqueue.popleft() + heapq.heappush(h, -inputrev) seen = set() while h: current = -heapq.heappop(h) if current not in seen: - if inputrev and current == inputrev: + if current == inputrev: if revqueue: inputrev = revqueue.popleft() heapq.heappush(h, -inputrev)