comparison hgext/hgk.py @ 8459:1e63816ce8a2

hgk: use set instead of dict
author Benoit Boissinot <benoit.boissinot@ens-lyon.org>
date Sun, 17 May 2009 03:25:24 +0200
parents eee2319c5895
children 94ca38e63576
comparison
equal deleted inserted replaced
8458:f6c99b1628d7 8459:1e63816ce8a2
229 elif args[i] != 'HEAD': 229 elif args[i] != 'HEAD':
230 want_sha1.append(repo.lookup(args[i])) 230 want_sha1.append(repo.lookup(args[i]))
231 231
232 # calculate the graph for the supplied commits 232 # calculate the graph for the supplied commits
233 for i in xrange(len(want_sha1)): 233 for i in xrange(len(want_sha1)):
234 reachable.append({}); 234 reachable.append(set());
235 n = want_sha1[i]; 235 n = want_sha1[i];
236 visit = [n]; 236 visit = [n];
237 reachable[i][n] = 1 237 reachable[i].add(n)
238 while visit: 238 while visit:
239 n = visit.pop(0) 239 n = visit.pop(0)
240 if n in stop_sha1: 240 if n in stop_sha1:
241 continue 241 continue
242 for p in repo.changelog.parents(n): 242 for p in repo.changelog.parents(n):
243 if p not in reachable[i]: 243 if p not in reachable[i]:
244 reachable[i][p] = 1 244 reachable[i].add(p)
245 visit.append(p) 245 visit.append(p)
246 if p in stop_sha1: 246 if p in stop_sha1:
247 continue 247 continue
248 248
249 # walk the repository looking for commits that are in our 249 # walk the repository looking for commits that are in our