Mercurial > public > mercurial-scm > hg
comparison mercurial/hbisect.py @ 6762:f67d1468ac50
util: add sort helper
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Fri, 27 Jun 2008 18:28:45 -0500 |
parents | fb42030d79d6 |
children | 0b6f2fa5e03f |
comparison
equal
deleted
inserted
replaced
6761:cb981fc955fb | 6762:f67d1468ac50 |
---|---|
58 children[prev].append(rev) | 58 children[prev].append(rev) |
59 else: | 59 else: |
60 children[prev] = [rev] | 60 children[prev] = [rev] |
61 visit.append(prev) | 61 visit.append(prev) |
62 | 62 |
63 candidates.sort() | |
64 # have we narrowed it down to one entry? | 63 # have we narrowed it down to one entry? |
65 tot = len(candidates) | 64 tot = len(candidates) |
66 if tot == 1: | 65 if tot == 1: |
67 return (bad, 0, good) | 66 return (bad, 0, good) |
68 perfect = tot / 2 | 67 perfect = tot / 2 |
69 | 68 |
70 # find the best node to test | 69 # find the best node to test |
71 best_rev = None | 70 best_rev = None |
72 best_len = -1 | 71 best_len = -1 |
73 poison = {} | 72 poison = {} |
74 for rev in candidates: | 73 for rev in util.sort(candidates): |
75 if rev in poison: | 74 if rev in poison: |
76 for c in children.get(rev, []): | 75 for c in children.get(rev, []): |
77 poison[c] = True # poison children | 76 poison[c] = True # poison children |
78 continue | 77 continue |
79 | 78 |