Show More
@@ -1,4 +1,4 b'' | |||||
1 | #!/usr/bin/env python |
|
1 | # bisect extension for mercurial | |
2 | # |
|
2 | # | |
3 | # This software may be used and distributed according to the terms |
|
3 | # This software may be used and distributed according to the terms | |
4 | # of the GNU General Public License, incorporated herein by reference. |
|
4 | # of the GNU General Public License, incorporated herein by reference. | |
@@ -91,7 +91,7 b' class bisect(object):' | |||||
91 | if head is None: |
|
91 | if head is None: | |
92 | head = self.badrev |
|
92 | head = self.badrev | |
93 | return self.__ancestors_and_nb_ancestors(head, stop)[1] |
|
93 | return self.__ancestors_and_nb_ancestors(head, stop)[1] | |
94 |
|
94 | |||
95 | def ancestors(self, head=None, stop=None): |
|
95 | def ancestors(self, head=None, stop=None): | |
96 | """ |
|
96 | """ | |
97 | returns the set of the ancestors of head (self included) |
|
97 | returns the set of the ancestors of head (self included) | |
@@ -100,7 +100,7 b' class bisect(object):' | |||||
100 | if head is None: |
|
100 | if head is None: | |
101 | head = self.badrev |
|
101 | head = self.badrev | |
102 | return self.__ancestors_and_nb_ancestors(head, stop)[0] |
|
102 | return self.__ancestors_and_nb_ancestors(head, stop)[0] | |
103 |
|
103 | |||
104 | def __ancestors_and_nb_ancestors(self, head, stop=None): |
|
104 | def __ancestors_and_nb_ancestors(self, head, stop=None): | |
105 | """ |
|
105 | """ | |
106 | if stop is None then ancestors of goodrevs are used as |
|
106 | if stop is None then ancestors of goodrevs are used as | |
@@ -131,7 +131,7 b' class bisect(object):' | |||||
131 | for p in parents: |
|
131 | for p in parents: | |
132 | d[p][0] += 1 |
|
132 | d[p][0] += 1 | |
133 | return d |
|
133 | return d | |
134 |
|
134 | |||
135 | if head in stop: |
|
135 | if head in stop: | |
136 | self.ui.warn("Unconsistent state, %s is good and bad\n" |
|
136 | self.ui.warn("Unconsistent state, %s is good and bad\n" | |
137 | % hg.hex(head)) |
|
137 | % hg.hex(head)) | |
@@ -161,7 +161,8 b' class bisect(object):' | |||||
161 | if not self.goodrevs: |
|
161 | if not self.goodrevs: | |
162 | self.ui.warn("No good revision given\n") |
|
162 | self.ui.warn("No good revision given\n") | |
163 | self.ui.warn("Assuming the first revision is good\n") |
|
163 | self.ui.warn("Assuming the first revision is good\n") | |
164 |
ancestors, num_ancestors = self.__ancestors_and_nb_ancestors( |
|
164 | ancestors, num_ancestors = self.__ancestors_and_nb_ancestors( | |
|
165 | self.badrev) | |||
165 | tot = len(ancestors) |
|
166 | tot = len(ancestors) | |
166 | if tot == 1: |
|
167 | if tot == 1: | |
167 | if ancestors.pop() != self.badrev: |
|
168 | if ancestors.pop() != self.badrev: | |
@@ -260,7 +261,7 b' for subcommands see "hg bisect help\\"' | |||||
260 | for cmd in cmds: |
|
261 | for cmd in cmds: | |
261 | doc = cmdtable[cmd][0].__doc__.splitlines(0)[0].rstrip() |
|
262 | doc = cmdtable[cmd][0].__doc__.splitlines(0)[0].rstrip() | |
262 | ui.write(" %-*s %s\n" % (m, cmd, doc)) |
|
263 | ui.write(" %-*s %s\n" % (m, cmd, doc)) | |
263 |
|
264 | |||
264 | b = bisect(ui, repo) |
|
265 | b = bisect(ui, repo) | |
265 | bisectcmdtable = { |
|
266 | bisectcmdtable = { | |
266 | "init": (b.init, 0, "hg bisect init"), |
|
267 | "init": (b.init, 0, "hg bisect init"), | |
@@ -270,7 +271,7 b' for subcommands see "hg bisect help\\"' | |||||
270 | "reset": (b.reset, 0, "hg bisect reset"), |
|
271 | "reset": (b.reset, 0, "hg bisect reset"), | |
271 | "help": (help_, 1, "hg bisect help [<subcommand>]"), |
|
272 | "help": (help_, 1, "hg bisect help [<subcommand>]"), | |
272 | } |
|
273 | } | |
273 |
|
274 | |||
274 | if not bisectcmdtable.has_key(cmd): |
|
275 | if not bisectcmdtable.has_key(cmd): | |
275 | ui.warn("bisect: Unknown sub-command\n") |
|
276 | ui.warn("bisect: Unknown sub-command\n") | |
276 | return help_() |
|
277 | return help_() | |
@@ -280,7 +281,6 b' for subcommands see "hg bisect help\\"' | |||||
280 | return bisectcmdtable[cmd][0](*args) |
|
281 | return bisectcmdtable[cmd][0](*args) | |
281 |
|
282 | |||
282 | cmdtable = { |
|
283 | cmdtable = { | |
283 | "bisect": (bisect_run, [], |
|
284 | "bisect": (bisect_run, [], "hg bisect [help|init|reset|next|good|bad]"), | |
284 | "hg bisect [help|init|reset|next|good|bad]"), |
|
|||
285 | #"bisect-test": (test, [], "hg bisect-test rev"), |
|
285 | #"bisect-test": (test, [], "hg bisect-test rev"), | |
286 | } |
|
286 | } |
General Comments 0
You need to be logged in to leave comments.
Login now