Mercurial > hg > mercurial-crew-with-dirclash
comparison hgext/hgk.py @ 3468:0e68608bd11d
use xrange instead of range
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Thu, 19 Oct 2006 14:16:51 +0200 |
parents | eb0906ebba81 |
children | 3b4e00cba57a |
comparison
equal
deleted
inserted
replaced
3467:df7202f6887c | 3468:0e68608bd11d |
---|---|
175 # calculate and return the reachability bitmask for sha | 175 # calculate and return the reachability bitmask for sha |
176 def is_reachable(ar, reachable, sha): | 176 def is_reachable(ar, reachable, sha): |
177 if len(ar) == 0: | 177 if len(ar) == 0: |
178 return 1 | 178 return 1 |
179 mask = 0 | 179 mask = 0 |
180 for i in range(len(ar)): | 180 for i in xrange(len(ar)): |
181 if sha in reachable[i]: | 181 if sha in reachable[i]: |
182 mask |= 1 << i | 182 mask |= 1 << i |
183 | 183 |
184 return mask | 184 return mask |
185 | 185 |
188 want_sha1 = [] | 188 want_sha1 = [] |
189 count = 0 | 189 count = 0 |
190 | 190 |
191 # figure out which commits they are asking for and which ones they | 191 # figure out which commits they are asking for and which ones they |
192 # want us to stop on | 192 # want us to stop on |
193 for i in range(len(args)): | 193 for i in xrange(len(args)): |
194 if args[i].startswith('^'): | 194 if args[i].startswith('^'): |
195 s = repo.lookup(args[i][1:]) | 195 s = repo.lookup(args[i][1:]) |
196 stop_sha1.append(s) | 196 stop_sha1.append(s) |
197 want_sha1.append(s) | 197 want_sha1.append(s) |
198 elif args[i] != 'HEAD': | 198 elif args[i] != 'HEAD': |
199 want_sha1.append(repo.lookup(args[i])) | 199 want_sha1.append(repo.lookup(args[i])) |
200 | 200 |
201 # calculate the graph for the supplied commits | 201 # calculate the graph for the supplied commits |
202 for i in range(len(want_sha1)): | 202 for i in xrange(len(want_sha1)): |
203 reachable.append({}); | 203 reachable.append({}); |
204 n = want_sha1[i]; | 204 n = want_sha1[i]; |
205 visit = [n]; | 205 visit = [n]; |
206 reachable[i][n] = 1 | 206 reachable[i][n] = 1 |
207 while visit: | 207 while visit: |