Mercurial > hg-stable
annotate hgext/hbisect.py @ 5723:e3b09819496b
bisect: switch to rev-based calculation
- use revlog.parentrevs in search loops
- calculate stop directly in O(N) without reachable
- move badrev check into candidates
author | Matt Mackall <mpm@selenic.com> |
---|---|
date | Thu, 27 Dec 2007 23:55:39 -0600 |
parents | 862239055c2e |
children | 13653ee67859 |
rev | line source |
---|---|
1855
0ba9dee8cfbd
Fixed spacing/indentation, removed #! script header, added short description.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1854
diff
changeset
|
1 # bisect extension for mercurial |
1367
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
2 # |
1861
65949d1c9bf7
Added copyright information to hbisect.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1856
diff
changeset
|
3 # Copyright 2005, 2006 Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
65949d1c9bf7
Added copyright information to hbisect.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1856
diff
changeset
|
4 # Inspired by git bisect, extension skeleton taken from mq.py. |
65949d1c9bf7
Added copyright information to hbisect.py
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1856
diff
changeset
|
5 # |
1367
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
6 # This software may be used and distributed according to the terms |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
7 # of the GNU General Public License, incorporated herein by reference. |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
8 |
3891 | 9 from mercurial.i18n import _ |
3877
abaee83ce0a6
Replace demandload with new demandimport
Matt Mackall <mpm@selenic.com>
parents:
3643
diff
changeset
|
10 from mercurial import hg, util, commands, cmdutil |
5719
7edf0501f643
bisect: remove usage of sets
Matt Mackall <mpm@selenic.com>
parents:
5718
diff
changeset
|
11 import os, sys |
1367
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
12 |
1559
59b3639df0a9
Convert all classes to new-style classes by deriving them from object.
Eric Hopper <hopper@omnifarious.org>
parents:
1367
diff
changeset
|
13 class bisect(object): |
1367
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
14 """dichotomic search in the DAG of changesets""" |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
15 def __init__(self, ui, repo): |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
16 self.repo = repo |
1854
638b1bc6c6c9
Fixed contrib/hbisect.py to work with the new opener behaviour.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1748
diff
changeset
|
17 self.path = repo.join("bisect") |
638b1bc6c6c9
Fixed contrib/hbisect.py to work with the new opener behaviour.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1748
diff
changeset
|
18 self.opener = util.opener(self.path) |
1367
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
19 self.ui = ui |
5722
862239055c2e
bisect: fix up node vs rev naming
Matt Mackall <mpm@selenic.com>
parents:
5721
diff
changeset
|
20 self.goodnodes = [] |
862239055c2e
bisect: fix up node vs rev naming
Matt Mackall <mpm@selenic.com>
parents:
5721
diff
changeset
|
21 self.badnode = None |
1854
638b1bc6c6c9
Fixed contrib/hbisect.py to work with the new opener behaviour.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1748
diff
changeset
|
22 self.good_path = "good" |
638b1bc6c6c9
Fixed contrib/hbisect.py to work with the new opener behaviour.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1748
diff
changeset
|
23 self.bad_path = "bad" |
5319
5b6e403601d1
bisect: do silent init if necessary
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
5100
diff
changeset
|
24 self.is_reset = False |
1367
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
25 |
1854
638b1bc6c6c9
Fixed contrib/hbisect.py to work with the new opener behaviour.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1748
diff
changeset
|
26 if os.path.exists(os.path.join(self.path, self.good_path)): |
5722
862239055c2e
bisect: fix up node vs rev naming
Matt Mackall <mpm@selenic.com>
parents:
5721
diff
changeset
|
27 self.goodnodes = self.opener(self.good_path).read().splitlines() |
862239055c2e
bisect: fix up node vs rev naming
Matt Mackall <mpm@selenic.com>
parents:
5721
diff
changeset
|
28 self.goodnodes = [hg.bin(x) for x in self.goodnodes] |
1854
638b1bc6c6c9
Fixed contrib/hbisect.py to work with the new opener behaviour.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1748
diff
changeset
|
29 if os.path.exists(os.path.join(self.path, self.bad_path)): |
638b1bc6c6c9
Fixed contrib/hbisect.py to work with the new opener behaviour.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1748
diff
changeset
|
30 r = self.opener(self.bad_path).read().splitlines() |
1367
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
31 if r: |
5722
862239055c2e
bisect: fix up node vs rev naming
Matt Mackall <mpm@selenic.com>
parents:
5721
diff
changeset
|
32 self.badnode = hg.bin(r.pop(0)) |
1367
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
33 |
2735
07026da25ed8
hbisect.py: don't rely on __del__ to write the current state.
Alexis S. L. Carvalho <alexis@cecm.usp.br>
parents:
2348
diff
changeset
|
34 def write(self): |
5319
5b6e403601d1
bisect: do silent init if necessary
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
5100
diff
changeset
|
35 if self.is_reset: |
5b6e403601d1
bisect: do silent init if necessary
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
5100
diff
changeset
|
36 return |
1367
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
37 if not os.path.isdir(self.path): |
5319
5b6e403601d1
bisect: do silent init if necessary
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
5100
diff
changeset
|
38 os.mkdir(self.path) |
1854
638b1bc6c6c9
Fixed contrib/hbisect.py to work with the new opener behaviour.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1748
diff
changeset
|
39 f = self.opener(self.good_path, "w") |
5722
862239055c2e
bisect: fix up node vs rev naming
Matt Mackall <mpm@selenic.com>
parents:
5721
diff
changeset
|
40 f.write("\n".join([hg.hex(r) for r in self.goodnodes])) |
862239055c2e
bisect: fix up node vs rev naming
Matt Mackall <mpm@selenic.com>
parents:
5721
diff
changeset
|
41 if len(self.goodnodes) > 0: |
1367
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
42 f.write("\n") |
1854
638b1bc6c6c9
Fixed contrib/hbisect.py to work with the new opener behaviour.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1748
diff
changeset
|
43 f = self.opener(self.bad_path, "w") |
5722
862239055c2e
bisect: fix up node vs rev naming
Matt Mackall <mpm@selenic.com>
parents:
5721
diff
changeset
|
44 if self.badnode: |
862239055c2e
bisect: fix up node vs rev naming
Matt Mackall <mpm@selenic.com>
parents:
5721
diff
changeset
|
45 f.write(hg.hex(self.badnode) + "\n") |
1367
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
46 |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
47 def init(self): |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
48 """start a new bisection""" |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
49 if os.path.isdir(self.path): |
2348
1772852d7d14
better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2305
diff
changeset
|
50 raise util.Abort(_("bisect directory already exists\n")) |
1367
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
51 os.mkdir(self.path) |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
52 return 0 |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
53 |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
54 def reset(self): |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
55 """finish a bisection""" |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
56 if os.path.isdir(self.path): |
1854
638b1bc6c6c9
Fixed contrib/hbisect.py to work with the new opener behaviour.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1748
diff
changeset
|
57 sl = [os.path.join(self.path, p) |
638b1bc6c6c9
Fixed contrib/hbisect.py to work with the new opener behaviour.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1748
diff
changeset
|
58 for p in [self.bad_path, self.good_path]] |
1367
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
59 for s in sl: |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
60 if os.path.exists(s): |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
61 os.unlink(s) |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
62 os.rmdir(self.path) |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
63 # Not sure about this |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
64 #self.ui.write("Going back to tip\n") |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
65 #self.repo.update(self.repo.changelog.tip()) |
5319
5b6e403601d1
bisect: do silent init if necessary
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
5100
diff
changeset
|
66 self.is_reset = True |
5100
c13610d5642c
Return 0 as 'hg bisect reset' is successful
Guillaume Chazarain <guichaz@yahoo.fr>
parents:
4497
diff
changeset
|
67 return 0 |
1367
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
68 |
5721
8d63fa48d44a
bisect: clarify some bisection code
Matt Mackall <mpm@selenic.com>
parents:
5720
diff
changeset
|
69 def candidates(self): |
1367
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
70 """ |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
71 returns (anc, n_child) where anc is the set of the ancestors of head |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
72 and n_child is a dictionary with the following mapping: |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
73 node -> number of ancestors (self included) |
5718
442c613fd4aa
bisect: remove stop argument to ancestors function
Matt Mackall <mpm@selenic.com>
parents:
5717
diff
changeset
|
74 |
5722
862239055c2e
bisect: fix up node vs rev naming
Matt Mackall <mpm@selenic.com>
parents:
5721
diff
changeset
|
75 ancestors of goodnodes are used as lower limit. |
1367
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
76 """ |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
77 cl = self.repo.changelog |
5723
e3b09819496b
bisect: switch to rev-based calculation
Matt Mackall <mpm@selenic.com>
parents:
5722
diff
changeset
|
78 clparents = cl.parentrevs |
5722
862239055c2e
bisect: fix up node vs rev naming
Matt Mackall <mpm@selenic.com>
parents:
5721
diff
changeset
|
79 bad = self.badnode |
5723
e3b09819496b
bisect: switch to rev-based calculation
Matt Mackall <mpm@selenic.com>
parents:
5722
diff
changeset
|
80 badrev = cl.rev(bad) |
5719
7edf0501f643
bisect: remove usage of sets
Matt Mackall <mpm@selenic.com>
parents:
5718
diff
changeset
|
81 |
5723
e3b09819496b
bisect: switch to rev-based calculation
Matt Mackall <mpm@selenic.com>
parents:
5722
diff
changeset
|
82 # add goodrevs and all ancestors to stop |
e3b09819496b
bisect: switch to rev-based calculation
Matt Mackall <mpm@selenic.com>
parents:
5722
diff
changeset
|
83 stop = dict.fromkeys([cl.rev(n) for n in self.goodnodes]) |
e3b09819496b
bisect: switch to rev-based calculation
Matt Mackall <mpm@selenic.com>
parents:
5722
diff
changeset
|
84 for rev in xrange(cl.count(), -1, -1): |
e3b09819496b
bisect: switch to rev-based calculation
Matt Mackall <mpm@selenic.com>
parents:
5722
diff
changeset
|
85 if rev in stop: |
e3b09819496b
bisect: switch to rev-based calculation
Matt Mackall <mpm@selenic.com>
parents:
5722
diff
changeset
|
86 for prev in clparents(rev): |
e3b09819496b
bisect: switch to rev-based calculation
Matt Mackall <mpm@selenic.com>
parents:
5722
diff
changeset
|
87 stop[prev] = None |
e3b09819496b
bisect: switch to rev-based calculation
Matt Mackall <mpm@selenic.com>
parents:
5722
diff
changeset
|
88 |
e3b09819496b
bisect: switch to rev-based calculation
Matt Mackall <mpm@selenic.com>
parents:
5722
diff
changeset
|
89 if badrev in stop: |
4481
50a46ae14efb
hbisect: fix a typo in error message
TK Soh <teekaysoh@yahoo.com>
parents:
3643
diff
changeset
|
90 raise util.Abort(_("Inconsistent state, %s:%s is good and bad") |
5723
e3b09819496b
bisect: switch to rev-based calculation
Matt Mackall <mpm@selenic.com>
parents:
5722
diff
changeset
|
91 % (badrev, hg.short(bad))) |
5720
bd86c9f2f697
bisect: inline num_children function
Matt Mackall <mpm@selenic.com>
parents:
5719
diff
changeset
|
92 |
bd86c9f2f697
bisect: inline num_children function
Matt Mackall <mpm@selenic.com>
parents:
5719
diff
changeset
|
93 # build a dict of node -> [number of children, {}] |
5723
e3b09819496b
bisect: switch to rev-based calculation
Matt Mackall <mpm@selenic.com>
parents:
5722
diff
changeset
|
94 n_child = {badrev: [0, {}]} |
e3b09819496b
bisect: switch to rev-based calculation
Matt Mackall <mpm@selenic.com>
parents:
5722
diff
changeset
|
95 for rev in xrange(badrev + 1): |
e3b09819496b
bisect: switch to rev-based calculation
Matt Mackall <mpm@selenic.com>
parents:
5722
diff
changeset
|
96 if rev not in n_child: |
e3b09819496b
bisect: switch to rev-based calculation
Matt Mackall <mpm@selenic.com>
parents:
5722
diff
changeset
|
97 n_child[rev] = [0, {}] |
5721
8d63fa48d44a
bisect: clarify some bisection code
Matt Mackall <mpm@selenic.com>
parents:
5720
diff
changeset
|
98 # increment count of each parent |
5723
e3b09819496b
bisect: switch to rev-based calculation
Matt Mackall <mpm@selenic.com>
parents:
5722
diff
changeset
|
99 for p in clparents(rev): |
e3b09819496b
bisect: switch to rev-based calculation
Matt Mackall <mpm@selenic.com>
parents:
5722
diff
changeset
|
100 if p != hg.nullrev: |
5721
8d63fa48d44a
bisect: clarify some bisection code
Matt Mackall <mpm@selenic.com>
parents:
5720
diff
changeset
|
101 n_child[p][0] += 1 |
5720
bd86c9f2f697
bisect: inline num_children function
Matt Mackall <mpm@selenic.com>
parents:
5719
diff
changeset
|
102 |
5723
e3b09819496b
bisect: switch to rev-based calculation
Matt Mackall <mpm@selenic.com>
parents:
5722
diff
changeset
|
103 for rev in xrange(badrev + 1): |
e3b09819496b
bisect: switch to rev-based calculation
Matt Mackall <mpm@selenic.com>
parents:
5722
diff
changeset
|
104 for p in clparents(rev): |
e3b09819496b
bisect: switch to rev-based calculation
Matt Mackall <mpm@selenic.com>
parents:
5722
diff
changeset
|
105 if p != hg.nullrev: |
5721
8d63fa48d44a
bisect: clarify some bisection code
Matt Mackall <mpm@selenic.com>
parents:
5720
diff
changeset
|
106 n_child[p][0] -= 1 |
5723
e3b09819496b
bisect: switch to rev-based calculation
Matt Mackall <mpm@selenic.com>
parents:
5722
diff
changeset
|
107 if not rev in stop: |
e3b09819496b
bisect: switch to rev-based calculation
Matt Mackall <mpm@selenic.com>
parents:
5722
diff
changeset
|
108 n_child[rev][1].update(n_child[p][1]) |
5721
8d63fa48d44a
bisect: clarify some bisection code
Matt Mackall <mpm@selenic.com>
parents:
5720
diff
changeset
|
109 if n_child[p][0] == 0: |
8d63fa48d44a
bisect: clarify some bisection code
Matt Mackall <mpm@selenic.com>
parents:
5720
diff
changeset
|
110 n_child[p] = len(n_child[p][1]) |
5723
e3b09819496b
bisect: switch to rev-based calculation
Matt Mackall <mpm@selenic.com>
parents:
5722
diff
changeset
|
111 if not rev in stop: |
e3b09819496b
bisect: switch to rev-based calculation
Matt Mackall <mpm@selenic.com>
parents:
5722
diff
changeset
|
112 n_child[rev][1][rev] = 1 |
e3b09819496b
bisect: switch to rev-based calculation
Matt Mackall <mpm@selenic.com>
parents:
5722
diff
changeset
|
113 if n_child[rev][0] == 0: |
e3b09819496b
bisect: switch to rev-based calculation
Matt Mackall <mpm@selenic.com>
parents:
5722
diff
changeset
|
114 if rev == badrev: |
e3b09819496b
bisect: switch to rev-based calculation
Matt Mackall <mpm@selenic.com>
parents:
5722
diff
changeset
|
115 anc = n_child[rev][1] |
e3b09819496b
bisect: switch to rev-based calculation
Matt Mackall <mpm@selenic.com>
parents:
5722
diff
changeset
|
116 n_child[rev] = len(n_child[rev][1]) |
e3b09819496b
bisect: switch to rev-based calculation
Matt Mackall <mpm@selenic.com>
parents:
5722
diff
changeset
|
117 |
e3b09819496b
bisect: switch to rev-based calculation
Matt Mackall <mpm@selenic.com>
parents:
5722
diff
changeset
|
118 if badrev not in anc: |
e3b09819496b
bisect: switch to rev-based calculation
Matt Mackall <mpm@selenic.com>
parents:
5722
diff
changeset
|
119 raise util.Abort(_("Could not find the first bad revision")) |
e3b09819496b
bisect: switch to rev-based calculation
Matt Mackall <mpm@selenic.com>
parents:
5722
diff
changeset
|
120 |
1367
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
121 return anc, n_child |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
122 |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
123 def next(self): |
5722
862239055c2e
bisect: fix up node vs rev naming
Matt Mackall <mpm@selenic.com>
parents:
5721
diff
changeset
|
124 if not self.badnode: |
2348
1772852d7d14
better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2305
diff
changeset
|
125 raise util.Abort(_("You should give at least one bad revision")) |
5722
862239055c2e
bisect: fix up node vs rev naming
Matt Mackall <mpm@selenic.com>
parents:
5721
diff
changeset
|
126 if not self.goodnodes: |
2348
1772852d7d14
better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2305
diff
changeset
|
127 self.ui.warn(_("No good revision given\n")) |
1772852d7d14
better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2305
diff
changeset
|
128 self.ui.warn(_("Marking the first revision as good\n")) |
5721
8d63fa48d44a
bisect: clarify some bisection code
Matt Mackall <mpm@selenic.com>
parents:
5720
diff
changeset
|
129 ancestors, n_child = self.candidates() |
8d63fa48d44a
bisect: clarify some bisection code
Matt Mackall <mpm@selenic.com>
parents:
5720
diff
changeset
|
130 |
8d63fa48d44a
bisect: clarify some bisection code
Matt Mackall <mpm@selenic.com>
parents:
5720
diff
changeset
|
131 # have we narrowed it down to one entry? |
1367
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
132 tot = len(ancestors) |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
133 if tot == 1: |
2348
1772852d7d14
better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2305
diff
changeset
|
134 self.ui.write(_("The first bad revision is:\n")) |
3643
b4ad640a3bcf
templates: move changeset templating bits to cmdutils
Matt Mackall <mpm@selenic.com>
parents:
2875
diff
changeset
|
135 displayer = cmdutil.show_changeset(self.ui, self.repo, {}) |
5722
862239055c2e
bisect: fix up node vs rev naming
Matt Mackall <mpm@selenic.com>
parents:
5721
diff
changeset
|
136 displayer.show(changenode=self.badnode) |
2348
1772852d7d14
better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2305
diff
changeset
|
137 return None |
5721
8d63fa48d44a
bisect: clarify some bisection code
Matt Mackall <mpm@selenic.com>
parents:
5720
diff
changeset
|
138 |
8d63fa48d44a
bisect: clarify some bisection code
Matt Mackall <mpm@selenic.com>
parents:
5720
diff
changeset
|
139 # find the best node to test |
5723
e3b09819496b
bisect: switch to rev-based calculation
Matt Mackall <mpm@selenic.com>
parents:
5722
diff
changeset
|
140 best_rev = None |
1367
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
141 best_len = -1 |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
142 for n in ancestors: |
5721
8d63fa48d44a
bisect: clarify some bisection code
Matt Mackall <mpm@selenic.com>
parents:
5720
diff
changeset
|
143 a = n_child[n] # number of children |
8d63fa48d44a
bisect: clarify some bisection code
Matt Mackall <mpm@selenic.com>
parents:
5720
diff
changeset
|
144 b = tot - a # number of ancestors |
8d63fa48d44a
bisect: clarify some bisection code
Matt Mackall <mpm@selenic.com>
parents:
5720
diff
changeset
|
145 value = min(a, b) # how good is this test? |
8d63fa48d44a
bisect: clarify some bisection code
Matt Mackall <mpm@selenic.com>
parents:
5720
diff
changeset
|
146 if value > best_len: |
8d63fa48d44a
bisect: clarify some bisection code
Matt Mackall <mpm@selenic.com>
parents:
5720
diff
changeset
|
147 best_len = value |
5723
e3b09819496b
bisect: switch to rev-based calculation
Matt Mackall <mpm@selenic.com>
parents:
5722
diff
changeset
|
148 best_rev = n |
e3b09819496b
bisect: switch to rev-based calculation
Matt Mackall <mpm@selenic.com>
parents:
5722
diff
changeset
|
149 assert best_rev is not None |
e3b09819496b
bisect: switch to rev-based calculation
Matt Mackall <mpm@selenic.com>
parents:
5722
diff
changeset
|
150 best_node = self.repo.changelog.node(best_rev) |
5721
8d63fa48d44a
bisect: clarify some bisection code
Matt Mackall <mpm@selenic.com>
parents:
5720
diff
changeset
|
151 |
8d63fa48d44a
bisect: clarify some bisection code
Matt Mackall <mpm@selenic.com>
parents:
5720
diff
changeset
|
152 # compute the approximate number of remaining tests |
2348
1772852d7d14
better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2305
diff
changeset
|
153 nb_tests = 0 |
1772852d7d14
better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2305
diff
changeset
|
154 q, r = divmod(tot, 2) |
1772852d7d14
better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2305
diff
changeset
|
155 while q: |
1772852d7d14
better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2305
diff
changeset
|
156 nb_tests += 1 |
1772852d7d14
better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2305
diff
changeset
|
157 q, r = divmod(q, 2) |
5721
8d63fa48d44a
bisect: clarify some bisection code
Matt Mackall <mpm@selenic.com>
parents:
5720
diff
changeset
|
158 |
5723
e3b09819496b
bisect: switch to rev-based calculation
Matt Mackall <mpm@selenic.com>
parents:
5722
diff
changeset
|
159 self.ui.write(_("Testing changeset %s:%s " |
e3b09819496b
bisect: switch to rev-based calculation
Matt Mackall <mpm@selenic.com>
parents:
5722
diff
changeset
|
160 "(%s changesets remaining, ~%s tests)\n") |
e3b09819496b
bisect: switch to rev-based calculation
Matt Mackall <mpm@selenic.com>
parents:
5722
diff
changeset
|
161 % (best_rev, hg.short(best_node), tot, nb_tests)) |
5722
862239055c2e
bisect: fix up node vs rev naming
Matt Mackall <mpm@selenic.com>
parents:
5721
diff
changeset
|
162 return best_node |
1367
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
163 |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
164 def autonext(self): |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
165 """find and update to the next revision to test""" |
5722
862239055c2e
bisect: fix up node vs rev naming
Matt Mackall <mpm@selenic.com>
parents:
5721
diff
changeset
|
166 node = self.next() |
862239055c2e
bisect: fix up node vs rev naming
Matt Mackall <mpm@selenic.com>
parents:
5721
diff
changeset
|
167 if node is not None: |
5717
18fdfafdb3e9
bisect: use bail_if_changed
Matt Mackall <mpm@selenic.com>
parents:
5715
diff
changeset
|
168 cmdutil.bail_if_changed(self.repo) |
5722
862239055c2e
bisect: fix up node vs rev naming
Matt Mackall <mpm@selenic.com>
parents:
5721
diff
changeset
|
169 return hg.clean(self.repo, node) |
1367
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
170 |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
171 def autogood(self, rev=None): |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
172 """mark revision as good and update to the next revision to test""" |
5722
862239055c2e
bisect: fix up node vs rev naming
Matt Mackall <mpm@selenic.com>
parents:
5721
diff
changeset
|
173 self.goodnodes.append(self.repo.lookup(rev or '.')) |
862239055c2e
bisect: fix up node vs rev naming
Matt Mackall <mpm@selenic.com>
parents:
5721
diff
changeset
|
174 if self.badnode: |
2348
1772852d7d14
better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2305
diff
changeset
|
175 return self.autonext() |
1367
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
176 |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
177 def autobad(self, rev=None): |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
178 """mark revision as bad and update to the next revision to test""" |
5722
862239055c2e
bisect: fix up node vs rev naming
Matt Mackall <mpm@selenic.com>
parents:
5721
diff
changeset
|
179 self.badnode = self.repo.lookup(rev or '.') |
862239055c2e
bisect: fix up node vs rev naming
Matt Mackall <mpm@selenic.com>
parents:
5721
diff
changeset
|
180 if self.goodnodes: |
1367
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
181 self.autonext() |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
182 |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
183 # should we put it in the class ? |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
184 def test(ui, repo, rev): |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
185 """test the bisection code""" |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
186 b = bisect(ui, repo) |
5722
862239055c2e
bisect: fix up node vs rev naming
Matt Mackall <mpm@selenic.com>
parents:
5721
diff
changeset
|
187 node = repo.lookup(rev) |
862239055c2e
bisect: fix up node vs rev naming
Matt Mackall <mpm@selenic.com>
parents:
5721
diff
changeset
|
188 ui.write("testing with rev %s\n" % hg.hex(node)) |
1367
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
189 anc = b.ancestors() |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
190 while len(anc) > 1: |
5722
862239055c2e
bisect: fix up node vs rev naming
Matt Mackall <mpm@selenic.com>
parents:
5721
diff
changeset
|
191 if not node in anc: |
1367
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
192 ui.warn("failure while bisecting\n") |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
193 sys.exit(1) |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
194 ui.write("it worked :)\n") |
5722
862239055c2e
bisect: fix up node vs rev naming
Matt Mackall <mpm@selenic.com>
parents:
5721
diff
changeset
|
195 new_node = b.next() |
1367
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
196 ui.write("choosing if good or bad\n") |
5722
862239055c2e
bisect: fix up node vs rev naming
Matt Mackall <mpm@selenic.com>
parents:
5721
diff
changeset
|
197 if node in b.ancestors(head=new_node): |
862239055c2e
bisect: fix up node vs rev naming
Matt Mackall <mpm@selenic.com>
parents:
5721
diff
changeset
|
198 b.bad(new_node) |
1367
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
199 ui.write("it is bad\n") |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
200 else: |
5722
862239055c2e
bisect: fix up node vs rev naming
Matt Mackall <mpm@selenic.com>
parents:
5721
diff
changeset
|
201 b.good(new_node) |
1367
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
202 ui.write("it is good\n") |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
203 anc = b.ancestors() |
5722
862239055c2e
bisect: fix up node vs rev naming
Matt Mackall <mpm@selenic.com>
parents:
5721
diff
changeset
|
204 #repo.update(new_node, force=True) |
1367
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
205 for v in anc: |
5722
862239055c2e
bisect: fix up node vs rev naming
Matt Mackall <mpm@selenic.com>
parents:
5721
diff
changeset
|
206 if v != node: |
1367
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
207 ui.warn("fail to found cset! :(\n") |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
208 return 1 |
5722
862239055c2e
bisect: fix up node vs rev naming
Matt Mackall <mpm@selenic.com>
parents:
5721
diff
changeset
|
209 ui.write("Found bad cset: %s\n" % hg.hex(b.badnode)) |
1367
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
210 ui.write("Everything is ok :)\n") |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
211 return 0 |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
212 |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
213 def bisect_run(ui, repo, cmd=None, *args): |
4390
052062b98f26
Flesh out bisect help text
Brendan Cully <brendan@kublai.com>
parents:
3891
diff
changeset
|
214 """Dichotomic search in the DAG of changesets |
052062b98f26
Flesh out bisect help text
Brendan Cully <brendan@kublai.com>
parents:
3891
diff
changeset
|
215 |
052062b98f26
Flesh out bisect help text
Brendan Cully <brendan@kublai.com>
parents:
3891
diff
changeset
|
216 This extension helps to find changesets which cause problems. |
052062b98f26
Flesh out bisect help text
Brendan Cully <brendan@kublai.com>
parents:
3891
diff
changeset
|
217 To use, mark the earliest changeset you know introduces the problem |
052062b98f26
Flesh out bisect help text
Brendan Cully <brendan@kublai.com>
parents:
3891
diff
changeset
|
218 as bad, then mark the latest changeset which is free from the problem |
052062b98f26
Flesh out bisect help text
Brendan Cully <brendan@kublai.com>
parents:
3891
diff
changeset
|
219 as good. Bisect will update your working directory to a revision for |
052062b98f26
Flesh out bisect help text
Brendan Cully <brendan@kublai.com>
parents:
3891
diff
changeset
|
220 testing. Once you have performed tests, mark the working directory |
052062b98f26
Flesh out bisect help text
Brendan Cully <brendan@kublai.com>
parents:
3891
diff
changeset
|
221 as bad or good and bisect will either update to another candidate |
052062b98f26
Flesh out bisect help text
Brendan Cully <brendan@kublai.com>
parents:
3891
diff
changeset
|
222 changeset or announce that it has found the bad revision. |
052062b98f26
Flesh out bisect help text
Brendan Cully <brendan@kublai.com>
parents:
3891
diff
changeset
|
223 |
052062b98f26
Flesh out bisect help text
Brendan Cully <brendan@kublai.com>
parents:
3891
diff
changeset
|
224 Note: bisect expects bad revisions to be descendants of good revisions. |
052062b98f26
Flesh out bisect help text
Brendan Cully <brendan@kublai.com>
parents:
3891
diff
changeset
|
225 If you are looking for the point at which a problem was fixed, then make |
052062b98f26
Flesh out bisect help text
Brendan Cully <brendan@kublai.com>
parents:
3891
diff
changeset
|
226 the problem-free state "bad" and the problematic state "good." |
052062b98f26
Flesh out bisect help text
Brendan Cully <brendan@kublai.com>
parents:
3891
diff
changeset
|
227 |
052062b98f26
Flesh out bisect help text
Brendan Cully <brendan@kublai.com>
parents:
3891
diff
changeset
|
228 For subcommands see "hg bisect help\" |
1367
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
229 """ |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
230 def help_(cmd=None, *args): |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
231 """show help for a given bisect subcommand or all subcommands""" |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
232 cmdtable = bisectcmdtable |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
233 if cmd: |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
234 doc = cmdtable[cmd][0].__doc__ |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
235 synopsis = cmdtable[cmd][2] |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
236 ui.write(synopsis + "\n") |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
237 ui.write("\n" + doc + "\n") |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
238 return |
2348
1772852d7d14
better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2305
diff
changeset
|
239 ui.write(_("list of subcommands for the bisect extension\n\n")) |
1367
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
240 cmds = cmdtable.keys() |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
241 cmds.sort() |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
242 m = max([len(c) for c in cmds]) |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
243 for cmd in cmds: |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
244 doc = cmdtable[cmd][0].__doc__.splitlines(0)[0].rstrip() |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
245 ui.write(" %-*s %s\n" % (m, cmd, doc)) |
1855
0ba9dee8cfbd
Fixed spacing/indentation, removed #! script header, added short description.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1854
diff
changeset
|
246 |
1367
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
247 b = bisect(ui, repo) |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
248 bisectcmdtable = { |
2348
1772852d7d14
better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2305
diff
changeset
|
249 "init": (b.init, 0, _("hg bisect init")), |
1772852d7d14
better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2305
diff
changeset
|
250 "bad": (b.autobad, 1, _("hg bisect bad [<rev>]")), |
1772852d7d14
better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2305
diff
changeset
|
251 "good": (b.autogood, 1, _("hg bisect good [<rev>]")), |
1772852d7d14
better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2305
diff
changeset
|
252 "next": (b.autonext, 0, _("hg bisect next")), |
1772852d7d14
better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2305
diff
changeset
|
253 "reset": (b.reset, 0, _("hg bisect reset")), |
1772852d7d14
better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2305
diff
changeset
|
254 "help": (help_, 1, _("hg bisect help [<subcommand>]")), |
1367
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
255 } |
1855
0ba9dee8cfbd
Fixed spacing/indentation, removed #! script header, added short description.
Thomas Arendsen Hein <thomas@intevation.de>
parents:
1854
diff
changeset
|
256 |
1367
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
257 if not bisectcmdtable.has_key(cmd): |
2348
1772852d7d14
better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2305
diff
changeset
|
258 ui.warn(_("bisect: Unknown sub-command\n")) |
1367
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
259 return help_() |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
260 if len(args) > bisectcmdtable[cmd][1]: |
2348
1772852d7d14
better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2305
diff
changeset
|
261 ui.warn(_("bisect: Too many arguments\n")) |
1367
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
262 return help_() |
5322
121816063b9a
bisect: remove useless try/except
Patrick Mezard <pmezard@gmail.com>
parents:
5320
diff
changeset
|
263 ret = bisectcmdtable[cmd][0](*args) |
121816063b9a
bisect: remove useless try/except
Patrick Mezard <pmezard@gmail.com>
parents:
5320
diff
changeset
|
264 b.write() |
121816063b9a
bisect: remove useless try/except
Patrick Mezard <pmezard@gmail.com>
parents:
5320
diff
changeset
|
265 return ret |
1367
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
266 |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
267 cmdtable = { |
2348
1772852d7d14
better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
2305
diff
changeset
|
268 "bisect": (bisect_run, [], _("hg bisect [help|init|reset|next|good|bad]")), |
1367
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
269 #"bisect-test": (test, [], "hg bisect-test rev"), |
a7678cbd7c28
bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff
changeset
|
270 } |