Show More
@@ -151,7 +151,8 b' class bisect(object):' | |||||
151 | self.write() |
|
151 | self.write() | |
152 | return self.next() |
|
152 | return self.next() | |
153 |
|
153 | |||
154 |
def bisect_run(ui, repo, |
|
154 | def bisect_run(ui, repo, node=None, extra=None, | |
|
155 | reset=None, good=None, bad=None, skip=None): | |||
155 | """Subdivision search of changesets |
|
156 | """Subdivision search of changesets | |
156 |
|
157 | |||
157 | This extension helps to find changesets which introduce problems. |
|
158 | This extension helps to find changesets which introduce problems. | |
@@ -166,48 +167,37 b' Note: bisect expects bad revisions to be' | |||||
166 | If you are looking for the point at which a problem was fixed, then make |
|
167 | If you are looking for the point at which a problem was fixed, then make | |
167 | the problem-free state "bad" and the problematic state "good." |
|
168 | the problem-free state "bad" and the problematic state "good." | |
168 |
|
169 | |||
169 | For subcommands see "hg bisect help\" |
|
|||
170 | """ |
|
170 | """ | |
171 | def help_(cmd=None, *args): |
|
171 | # backward compatibility | |
172 | """show help for a given bisect subcommand or all subcommands""" |
|
172 | if node in "good bad reset init".split(): | |
173 | cmdtable = bisectcmdtable |
|
173 | ui.warn(_("(use of 'hg bisect <cmd>' is deprecated)\n")) | |
174 | if cmd: |
|
174 | cmd, node, extra = node, extra, None | |
175 | doc = cmdtable[cmd][0].__doc__ |
|
175 | if cmd == "good": | |
176 | synopsis = cmdtable[cmd][2] |
|
176 | good = True | |
177 | ui.write(synopsis + "\n") |
|
177 | elif cmd == "bad": | |
178 | ui.write("\n" + doc + "\n") |
|
178 | bad = True | |
179 | return |
|
179 | else: | |
180 | ui.write(_("list of subcommands for the bisect extension\n\n")) |
|
180 | reset = True | |
181 | cmds = cmdtable.keys() |
|
181 | elif extra or good + bad + skip + reset > 1: | |
182 | cmds.sort() |
|
182 | raise util.Abort("Incompatible arguments") | |
183 | m = max([len(c) for c in cmds]) |
|
|||
184 | for cmd in cmds: |
|
|||
185 | doc = cmdtable[cmd][0].__doc__.splitlines(0)[0].rstrip() |
|
|||
186 | ui.write(" %-*s %s\n" % (m, cmd, doc)) |
|
|||
187 |
|
183 | |||
188 | b = bisect(ui, repo) |
|
184 | b = bisect(ui, repo) | |
189 | bisectcmdtable = { |
|
185 | if good: | |
190 | "init": (b.init, 0, _("hg bisect init")), |
|
186 | return b.good(node) | |
191 | "bad": (b.bad, 1, _("hg bisect bad [<rev>]")), |
|
187 | elif bad: | |
192 | "good": (b.good, 1, _("hg bisect good [<rev>]")), |
|
188 | return b.bad(node) | |
193 | "skip": (b.skip, 1, _("hg bisect skip [<rev>]")), |
|
189 | elif skip: | |
194 | "next": (b.next, 0, _("hg bisect next")), |
|
190 | return b.skip(node) | |
195 | "help": (help_, 1, _("hg bisect help [<subcommand>]")), |
|
191 | elif reset: | |
196 | } |
|
192 | return b.init() | |
197 |
|
193 | else: | ||
198 | if cmd == "reset": |
|
194 | return b.next() | |
199 | cmd = "init" |
|
|||
200 |
|
||||
201 | if not bisectcmdtable.has_key(cmd): |
|
|||
202 | ui.warn(_("bisect: Unknown sub-command\n")) |
|
|||
203 | return help_() |
|
|||
204 | if len(args) > bisectcmdtable[cmd][1]: |
|
|||
205 | ui.warn(_("bisect: Too many arguments\n")) |
|
|||
206 | return help_() |
|
|||
207 | ret = bisectcmdtable[cmd][0](*args) |
|
|||
208 | return ret |
|
|||
209 |
|
195 | |||
210 | cmdtable = { |
|
196 | cmdtable = { | |
211 | "bisect": (bisect_run, [], _("hg bisect [help|init|reset|next|good|bad]")), |
|
197 | "bisect": (bisect_run, | |
212 | #"bisect-test": (test, [], "hg bisect-test rev"), |
|
198 | [('r', 'reset', False, _('reset bisect state')), | |
|
199 | ('g', 'good', False, _('mark changeset good')), | |||
|
200 | ('b', 'bad', False, _('mark changeset bad')), | |||
|
201 | ('s', 'skip', False, _('skip testing changeset'))], | |||
|
202 | _("hg bisect [-gbsr] [REV]")) | |||
213 | } |
|
203 | } |
@@ -26,11 +26,11 b' echo % hg up -C' | |||||
26 | hg up -C |
|
26 | hg up -C | |
27 |
|
27 | |||
28 | echo % bisect test |
|
28 | echo % bisect test | |
29 |
hg bisect |
|
29 | hg bisect -r | |
30 |
hg bisect b |
|
30 | hg bisect -b | |
31 |
hg bisect g |
|
31 | hg bisect -g 1 | |
32 |
hg bisect g |
|
32 | hg bisect -g | |
33 |
hg bisect g |
|
33 | hg bisect -g | |
34 |
hg bisect g |
|
34 | hg bisect -g | |
35 |
hg bisect b |
|
35 | hg bisect -b | |
36 |
hg bisect g |
|
36 | hg bisect -g |
General Comments 0
You need to be logged in to leave comments.
Login now