diff --git a/mercurial/ancestor.py b/mercurial/ancestor.py --- a/mercurial/ancestor.py +++ b/mercurial/ancestor.py @@ -42,24 +42,24 @@ def ancestor(a, b, pfunc): # traverse ancestors in order of decreasing distance from root def ancestors(vertex): h = [(depth[vertex], vertex)] - seen = {} + seen = set() while h: d, n = heapq.heappop(h) if n not in seen: - seen[n] = 1 + seen.add(n) yield (d, n) for p in parentcache[n]: heapq.heappush(h, (depth[p], p)) def generations(vertex): - sg, s = None, {} + sg, s = None, set() for g, v in ancestors(vertex): if g != sg: if sg: yield sg, s - sg, s = g, {v:1} + sg, s = g, set((v,)) else: - s[v] = 1 + s.add(v) yield sg, s x = generations(a)