Show More
@@ -151,7 +151,8 b' class bisect(object):' | |||
|
151 | 151 | self.write() |
|
152 | 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 | 156 | """Subdivision search of changesets |
|
156 | 157 | |
|
157 | 158 | This extension helps to find changesets which introduce problems. |
@@ -166,48 +167,37 b' Note: bisect expects bad revisions to be' | |||
|
166 | 167 | If you are looking for the point at which a problem was fixed, then make |
|
167 | 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): | |
|
172 | """show help for a given bisect subcommand or all subcommands""" | |
|
173 | cmdtable = bisectcmdtable | |
|
174 | if cmd: | |
|
175 | doc = cmdtable[cmd][0].__doc__ | |
|
176 | synopsis = cmdtable[cmd][2] | |
|
177 | ui.write(synopsis + "\n") | |
|
178 | ui.write("\n" + doc + "\n") | |
|
179 | return | |
|
180 | ui.write(_("list of subcommands for the bisect extension\n\n")) | |
|
181 | cmds = cmdtable.keys() | |
|
182 | cmds.sort() | |
|
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)) | |
|
171 | # backward compatibility | |
|
172 | if node in "good bad reset init".split(): | |
|
173 | ui.warn(_("(use of 'hg bisect <cmd>' is deprecated)\n")) | |
|
174 | cmd, node, extra = node, extra, None | |
|
175 | if cmd == "good": | |
|
176 | good = True | |
|
177 | elif cmd == "bad": | |
|
178 | bad = True | |
|
179 | else: | |
|
180 | reset = True | |
|
181 | elif extra or good + bad + skip + reset > 1: | |
|
182 | raise util.Abort("Incompatible arguments") | |
|
187 | 183 | |
|
188 | 184 | b = bisect(ui, repo) |
|
189 | bisectcmdtable = { | |
|
190 | "init": (b.init, 0, _("hg bisect init")), | |
|
191 | "bad": (b.bad, 1, _("hg bisect bad [<rev>]")), | |
|
192 | "good": (b.good, 1, _("hg bisect good [<rev>]")), | |
|
193 | "skip": (b.skip, 1, _("hg bisect skip [<rev>]")), | |
|
194 | "next": (b.next, 0, _("hg bisect next")), | |
|
195 | "help": (help_, 1, _("hg bisect help [<subcommand>]")), | |
|
196 | } | |
|
197 | ||
|
198 | if cmd == "reset": | |
|
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 | |
|
185 | if good: | |
|
186 | return b.good(node) | |
|
187 | elif bad: | |
|
188 | return b.bad(node) | |
|
189 | elif skip: | |
|
190 | return b.skip(node) | |
|
191 | elif reset: | |
|
192 | return b.init() | |
|
193 | else: | |
|
194 | return b.next() | |
|
209 | 195 | |
|
210 | 196 | cmdtable = { |
|
211 | "bisect": (bisect_run, [], _("hg bisect [help|init|reset|next|good|bad]")), | |
|
212 | #"bisect-test": (test, [], "hg bisect-test rev"), | |
|
197 | "bisect": (bisect_run, | |
|
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 | 26 | hg up -C |
|
27 | 27 | |
|
28 | 28 | echo % bisect test |
|
29 |
hg bisect |
|
|
30 |
hg bisect b |
|
|
31 |
hg bisect g |
|
|
32 |
hg bisect g |
|
|
33 |
hg bisect g |
|
|
34 |
hg bisect g |
|
|
35 |
hg bisect b |
|
|
36 |
hg bisect g |
|
|
29 | hg bisect -r | |
|
30 | hg bisect -b | |
|
31 | hg bisect -g 1 | |
|
32 | hg bisect -g | |
|
33 | hg bisect -g | |
|
34 | hg bisect -g | |
|
35 | hg bisect -b | |
|
36 | hg bisect -g |
General Comments 0
You need to be logged in to leave comments.
Login now