Mercurial > public > mercurial-scm > hg
comparison mercurial/hbisect.py @ 15153:fa0a464e4ca5
hbisect: add two new revset descriptions: 'goods' and 'bads'
This patch adds two new revset descriptions:
- 'goods': the list of topologicaly-good csets:
- if good csets are topologically before bad csets, yields '::good'
- else, yields 'good::'
- and conversely for 'bads'
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
author | "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr> |
---|---|
date | Sat, 24 Sep 2011 01:32:50 +0200 |
parents | 395ca8cd2669 |
children | aa2e908c521e |
comparison
equal
deleted
inserted
replaced
15151:0d4f6e843b05 | 15153:fa0a464e4ca5 |
---|---|
156 | 156 |
157 def get(repo, status): | 157 def get(repo, status): |
158 """ | 158 """ |
159 Return a list of revision(s) that match the given status: | 159 Return a list of revision(s) that match the given status: |
160 | 160 |
161 - ``good``, ``bad``, ``skip``: as the names imply | 161 - ``good``, ``bad``, ``skip``: csets explicitly marked as good/bad/skip |
162 - ``range`` : all csets taking part in the bisection | 162 - ``goods``, ``bads`` : csets topologicaly good/bad |
163 - ``pruned`` : csets that are good, bad or skipped | 163 - ``range`` : csets taking part in the bisection |
164 - ``pruned`` : csets that are goods, bads or skipped | |
164 - ``untested`` : csets whose fate is yet unknown | 165 - ``untested`` : csets whose fate is yet unknown |
165 - ``ignored`` : csets ignored due to DAG topology | 166 - ``ignored`` : csets ignored due to DAG topology |
166 """ | 167 """ |
167 state = load_state(repo) | 168 state = load_state(repo) |
168 if status in ('good', 'bad', 'skip'): | 169 if status in ('good', 'bad', 'skip'): |
176 # 'range' is all csets that make the bisection: | 177 # 'range' is all csets that make the bisection: |
177 # - have a good ancestor and a bad descendant, or conversely | 178 # - have a good ancestor and a bad descendant, or conversely |
178 # that's because the bisection can go either way | 179 # that's because the bisection can go either way |
179 range = '( bisect(bad)::bisect(good) | bisect(good)::bisect(bad) )' | 180 range = '( bisect(bad)::bisect(good) | bisect(good)::bisect(bad) )' |
180 | 181 |
181 # 'pruned' is all csets whose fate is already known: | 182 _t = [c.rev() for c in repo.set('bisect(good)::bisect(bad)')] |
182 # - a good ancestor and a good ascendant, or | 183 # The sets of topologically good or bad csets |
183 # - a bad ancestor and a bad descendant, or | 184 if len(_t) == 0: |
184 # - skipped | 185 # Goods are topologically after bads |
185 # But in case of irrelevant goods/bads, we also need to | 186 goods = 'bisect(good)::' # Pruned good csets |
186 # include them. | 187 bads = '::bisect(bad)' # Pruned bad csets |
187 pg = 'bisect(good)::bisect(good)' # Pruned goods | 188 else: |
188 pb = 'bisect(bad)::bisect(bad)' # Pruned bads | 189 # Goods are topologically before bads |
189 ps = 'bisect(skip)' # Pruned skipped | 190 goods = '::bisect(good)' # Pruned good csets |
190 pruned = '( (%s) | (%s) | (%s) )' % (pg, pb, ps) | 191 bads = 'bisect(bad)::' # Pruned bad csets |
192 | |
193 # 'pruned' is all csets whose fate is already known: good, bad, skip | |
194 skips = 'bisect(skip)' # Pruned skipped csets | |
195 pruned = '( (%s) | (%s) | (%s) )' % (goods, bads, skips) | |
191 | 196 |
192 # 'untested' is all cset that are- in 'range', but not in 'pruned' | 197 # 'untested' is all cset that are- in 'range', but not in 'pruned' |
193 untested = '( (%s) - (%s) )' % (range, pruned) | 198 untested = '( (%s) - (%s) )' % (range, pruned) |
194 | 199 |
195 # 'ignored' is all csets that were not used during the bisection | 200 # 'ignored' is all csets that were not used during the bisection |
206 return [c.rev() for c in repo.set(pruned)] | 211 return [c.rev() for c in repo.set(pruned)] |
207 elif status == 'untested': | 212 elif status == 'untested': |
208 return [c.rev() for c in repo.set(untested)] | 213 return [c.rev() for c in repo.set(untested)] |
209 elif status == 'ignored': | 214 elif status == 'ignored': |
210 return [c.rev() for c in repo.set(ignored)] | 215 return [c.rev() for c in repo.set(ignored)] |
216 elif status == "goods": | |
217 return [c.rev() for c in repo.set(goods)] | |
218 elif status == "bads": | |
219 return [c.rev() for c in repo.set(bads)] | |
211 | 220 |
212 else: | 221 else: |
213 raise error.ParseError(_('invalid bisect state')) | 222 raise error.ParseError(_('invalid bisect state')) |