Mercurial > public > mercurial-scm > hg
comparison mercurial/hbisect.py @ 8152:08e1baf924ca
replace set-like dictionaries with real sets
Many of the dictionaries created by dict.fromkeys were emulating sets.
These can now be replaced with real sets.
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Wed, 22 Apr 2009 00:57:28 +0200 |
parents | 496ae1ea4698 |
children | 46293a0c7e9f |
comparison
equal
deleted
inserted
replaced
8151:127281884959 | 8152:08e1baf924ca |
---|---|
22 'good' is True if bisect is searching for a first good changeset, False | 22 'good' is True if bisect is searching for a first good changeset, False |
23 if searching for a first bad one. | 23 if searching for a first bad one. |
24 """ | 24 """ |
25 | 25 |
26 clparents = changelog.parentrevs | 26 clparents = changelog.parentrevs |
27 skip = dict.fromkeys([changelog.rev(n) for n in state['skip']]) | 27 skip = set([changelog.rev(n) for n in state['skip']]) |
28 | 28 |
29 def buildancestors(bad, good): | 29 def buildancestors(bad, good): |
30 # only the earliest bad revision matters | 30 # only the earliest bad revision matters |
31 badrev = min([changelog.rev(n) for n in bad]) | 31 badrev = min([changelog.rev(n) for n in bad]) |
32 goodrevs = [changelog.rev(n) for n in good] | 32 goodrevs = [changelog.rev(n) for n in good] |
107 poison[c] = True # poison children | 107 poison[c] = True # poison children |
108 continue | 108 continue |
109 | 109 |
110 for c in children.get(rev, []): | 110 for c in children.get(rev, []): |
111 if ancestors[c]: | 111 if ancestors[c]: |
112 ancestors[c] = dict.fromkeys(ancestors[c] + a).keys() | 112 ancestors[c] = list(set(ancestors[c] + a)) |
113 else: | 113 else: |
114 ancestors[c] = a + [c] | 114 ancestors[c] = a + [c] |
115 | 115 |
116 assert best_rev is not None | 116 assert best_rev is not None |
117 best_node = changelog.node(best_rev) | 117 best_node = changelog.node(best_rev) |