comparison mercurial/revset.py @ 24940:6b54f749659b

revset: avoid returning duplicates when returning ancestors Before this patch, _revancestors were giving false result when a revision was duplicated in the input. Duplicated entry are rare but may happen when using the `%lx` notation internally. This series has no visible impact on the performance of the function according to benchmark.
author Pierre-Yves David <pierre-yves.david@fb.com>
date Wed, 26 Mar 2014 15:55:50 -0700
parents 85544a52ee84
children 405cb38448ad
comparison
equal deleted inserted replaced
24939:85544a52ee84 24940:6b54f749659b
35 return 35 return
36 36
37 seen = set() 37 seen = set()
38 while h: 38 while h:
39 current = -heapq.heappop(h) 39 current = -heapq.heappop(h)
40 if current == inputrev:
41 try:
42 inputrev = irevs.next()
43 heapq.heappush(h, -inputrev)
44 except StopIteration:
45 pass
40 if current not in seen: 46 if current not in seen:
41 if current == inputrev:
42 try:
43 inputrev = irevs.next()
44 heapq.heappush(h, -inputrev)
45 except StopIteration:
46 pass
47 seen.add(current) 47 seen.add(current)
48 yield current 48 yield current
49 for parent in cl.parentrevs(current)[:cut]: 49 for parent in cl.parentrevs(current)[:cut]:
50 if parent != node.nullrev: 50 if parent != node.nullrev:
51 heapq.heappush(h, -parent) 51 heapq.heappush(h, -parent)