annotate hgext/hbisect.py @ 5714:9d50b2450ac3

bisect: simplify lookup - use repo.lookup directly - move merge check to check_clean
author Matt Mackall <mpm@selenic.com>
date Thu, 27 Dec 2007 23:55:39 -0600
parents f9620af9f8d8
children d280774a7498
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
6b4127c7d52a Simplify i18n imports
Matt Mackall <mpm@selenic.com>
parents: 3877
diff changeset
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
abaee83ce0a6 Replace demandload with new demandimport
Matt Mackall <mpm@selenic.com>
parents: 3643
diff changeset
11 import os, sys, sets
1367
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
12
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
13 versionstr = "0.0.3"
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
14
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
15 def check_clean(ui, repo):
5714
9d50b2450ac3 bisect: simplify lookup
Matt Mackall <mpm@selenic.com>
parents: 5713
diff changeset
16 merged = (nullid in repo.dirstate.parents())
2875
3d6efcbbd1c9 remove localrepository.changes.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2808
diff changeset
17 modified, added, removed, deleted, unknown = repo.status()[:5]
5714
9d50b2450ac3 bisect: simplify lookup
Matt Mackall <mpm@selenic.com>
parents: 5713
diff changeset
18 if modified or added or removed or merged:
2875
3d6efcbbd1c9 remove localrepository.changes.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2808
diff changeset
19 ui.warn("Repository is not clean, please commit or revert\n")
3d6efcbbd1c9 remove localrepository.changes.
Vadim Gelfer <vadim.gelfer@gmail.com>
parents: 2808
diff changeset
20 sys.exit(1)
1367
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
21
1559
59b3639df0a9 Convert all classes to new-style classes by deriving them from object.
Eric Hopper <hopper@omnifarious.org>
parents: 1367
diff changeset
22 class bisect(object):
1367
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
23 """dichotomic search in the DAG of changesets"""
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
24 def __init__(self, ui, repo):
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
25 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
26 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
27 self.opener = util.opener(self.path)
1367
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
28 self.ui = ui
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
29 self.goodrevs = []
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
30 self.badrev = None
1854
638b1bc6c6c9 Fixed contrib/hbisect.py to work with the new opener behaviour.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1748
diff changeset
31 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
32 self.bad_path = "bad"
5319
5b6e403601d1 bisect: do silent init if necessary
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5100
diff changeset
33 self.is_reset = False
1367
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
34
1854
638b1bc6c6c9 Fixed contrib/hbisect.py to work with the new opener behaviour.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1748
diff changeset
35 if os.path.exists(os.path.join(self.path, self.good_path)):
638b1bc6c6c9 Fixed contrib/hbisect.py to work with the new opener behaviour.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1748
diff changeset
36 self.goodrevs = self.opener(self.good_path).read().splitlines()
1367
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
37 self.goodrevs = [hg.bin(x) for x in self.goodrevs]
1854
638b1bc6c6c9 Fixed contrib/hbisect.py to work with the new opener behaviour.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1748
diff changeset
38 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
39 r = self.opener(self.bad_path).read().splitlines()
1367
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
40 if r:
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
41 self.badrev = hg.bin(r.pop(0))
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
42
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
43 def write(self):
5319
5b6e403601d1 bisect: do silent init if necessary
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5100
diff changeset
44 if self.is_reset:
5b6e403601d1 bisect: do silent init if necessary
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 5100
diff changeset
45 return
1367
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
46 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
47 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
48 f = self.opener(self.good_path, "w")
1367
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
49 f.write("\n".join([hg.hex(r) for r in self.goodrevs]))
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
50 if len(self.goodrevs) > 0:
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
51 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
52 f = self.opener(self.bad_path, "w")
1367
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
53 if self.badrev:
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
54 f.write(hg.hex(self.badrev) + "\n")
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
55
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
56 def init(self):
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
57 """start a new bisection"""
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
58 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
59 raise util.Abort(_("bisect directory already exists\n"))
1367
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
60 os.mkdir(self.path)
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
61 check_clean(self.ui, self.repo)
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
62 return 0
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
63
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
64 def reset(self):
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
65 """finish a bisection"""
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
66 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
67 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
68 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
69 for s in sl:
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
70 if os.path.exists(s):
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
71 os.unlink(s)
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
72 os.rmdir(self.path)
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
73 # Not sure about this
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
74 #self.ui.write("Going back to tip\n")
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
75 #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
76 self.is_reset = True
5100
c13610d5642c Return 0 as 'hg bisect reset' is successful
Guillaume Chazarain <guichaz@yahoo.fr>
parents: 4497
diff changeset
77 return 0
1367
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
78
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
79 def __ancestors_and_nb_ancestors(self, head, stop=None):
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
80 """
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
81 if stop is None then ancestors of goodrevs are used as
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
82 lower limit.
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
83
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
84 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
85 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
86 node -> number of ancestors (self included)
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
87 """
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
88 cl = self.repo.changelog
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
89 if not stop:
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
90 stop = sets.Set([])
1856
b8bd84ad9b67 Make bisect extension work with python2.3
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1855
diff changeset
91 for i in xrange(len(self.goodrevs)-1, -1, -1):
b8bd84ad9b67 Make bisect extension work with python2.3
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1855
diff changeset
92 g = self.goodrevs[i]
1367
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
93 if g in stop:
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
94 continue
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
95 stop.update(cl.reachable(g))
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
96 def num_children(a):
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
97 """
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
98 returns a dictionnary with the following mapping
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
99 node -> [number of children, empty set]
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
100 """
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
101 d = {a: [0, sets.Set([])]}
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
102 for i in xrange(cl.rev(a)+1):
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
103 n = cl.node(i)
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
104 if not d.has_key(n):
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
105 d[n] = [0, sets.Set([])]
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
106 parents = [p for p in cl.parents(n) if p != hg.nullid]
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
107 for p in parents:
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
108 d[p][0] += 1
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
109 return d
1855
0ba9dee8cfbd Fixed spacing/indentation, removed #! script header, added short description.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1854
diff changeset
110
1367
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
111 if head in stop:
4481
50a46ae14efb hbisect: fix a typo in error message
TK Soh <teekaysoh@yahoo.com>
parents: 3643
diff changeset
112 raise util.Abort(_("Inconsistent state, %s:%s is good and bad")
2348
1772852d7d14 better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2305
diff changeset
113 % (cl.rev(head), hg.short(head)))
1367
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
114 n_child = num_children(head)
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
115 for i in xrange(cl.rev(head)+1):
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
116 n = cl.node(i)
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
117 parents = [p for p in cl.parents(n) if p != hg.nullid]
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
118 for p in parents:
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
119 n_child[p][0] -= 1
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
120 if not n in stop:
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
121 n_child[n][1].union_update(n_child[p][1])
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
122 if n_child[p][0] == 0:
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
123 n_child[p] = len(n_child[p][1])
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
124 if not n in stop:
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
125 n_child[n][1].add(n)
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
126 if n_child[n][0] == 0:
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
127 if n == head:
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
128 anc = n_child[n][1]
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
129 n_child[n] = len(n_child[n][1])
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
130 return anc, n_child
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
131
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
132 def next(self):
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
133 if not self.badrev:
2348
1772852d7d14 better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2305
diff changeset
134 raise util.Abort(_("You should give at least one bad revision"))
1367
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
135 if not self.goodrevs:
2348
1772852d7d14 better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2305
diff changeset
136 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
137 self.ui.warn(_("Marking the first revision as good\n"))
1855
0ba9dee8cfbd Fixed spacing/indentation, removed #! script header, added short description.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1854
diff changeset
138 ancestors, num_ancestors = self.__ancestors_and_nb_ancestors(
0ba9dee8cfbd Fixed spacing/indentation, removed #! script header, added short description.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1854
diff changeset
139 self.badrev)
1367
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
140 tot = len(ancestors)
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
141 if tot == 1:
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
142 if ancestors.pop() != self.badrev:
2348
1772852d7d14 better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2305
diff changeset
143 raise util.Abort(_("Could not find the first bad revision"))
1772852d7d14 better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2305
diff changeset
144 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
145 displayer = cmdutil.show_changeset(self.ui, self.repo, {})
2348
1772852d7d14 better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2305
diff changeset
146 displayer.show(changenode=self.badrev)
1772852d7d14 better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2305
diff changeset
147 return None
1367
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
148 best_rev = None
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
149 best_len = -1
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
150 for n in ancestors:
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
151 l = num_ancestors[n]
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
152 l = min(l, tot - l)
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
153 if l > best_len:
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
154 best_len = l
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
155 best_rev = n
2348
1772852d7d14 better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2305
diff changeset
156 assert best_rev is not None
1772852d7d14 better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2305
diff changeset
157 nb_tests = 0
1772852d7d14 better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2305
diff changeset
158 q, r = divmod(tot, 2)
1772852d7d14 better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2305
diff changeset
159 while q:
1772852d7d14 better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2305
diff changeset
160 nb_tests += 1
1772852d7d14 better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2305
diff changeset
161 q, r = divmod(q, 2)
1772852d7d14 better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2305
diff changeset
162 msg = _("Testing changeset %s:%s (%s changesets remaining, "
1772852d7d14 better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2305
diff changeset
163 "~%s tests)\n") % (self.repo.changelog.rev(best_rev),
1772852d7d14 better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2305
diff changeset
164 hg.short(best_rev), tot, nb_tests)
1772852d7d14 better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2305
diff changeset
165 self.ui.write(msg)
1367
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
166 return best_rev
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
167
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
168 def autonext(self):
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
169 """find and update to the next revision to test"""
5713
f9620af9f8d8 bisect: remove redundant clean checks
Matt Mackall <mpm@selenic.com>
parents: 5712
diff changeset
170 rev = self.next()
1367
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
171 check_clean(self.ui, self.repo)
2348
1772852d7d14 better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2305
diff changeset
172 if rev is not None:
2808
30f59f4a327e Introduce update helper functions: update, merge, clean, and revert
Matt Mackall <mpm@selenic.com>
parents: 2805
diff changeset
173 return hg.clean(self.repo, rev)
1367
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
174
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
175 def autogood(self, rev=None):
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
176 """mark revision as good and update to the next revision to test"""
5714
9d50b2450ac3 bisect: simplify lookup
Matt Mackall <mpm@selenic.com>
parents: 5713
diff changeset
177 self.goodrevs.append(self.repo.lookup(rev or '.'))
1367
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
178 if self.badrev:
2348
1772852d7d14 better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2305
diff changeset
179 return self.autonext()
1367
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
180
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
181 def autobad(self, rev=None):
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
182 """mark revision as bad and update to the next revision to test"""
5714
9d50b2450ac3 bisect: simplify lookup
Matt Mackall <mpm@selenic.com>
parents: 5713
diff changeset
183 self.badrev = self.repo.lookup(rev or '.')
1367
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
184 if self.goodrevs:
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
185 self.autonext()
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
186
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
187 # should we put it in the class ?
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
188 def test(ui, repo, rev):
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
189 """test the bisection code"""
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
190 b = bisect(ui, repo)
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
191 rev = repo.lookup(rev)
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
192 ui.write("testing with rev %s\n" % hg.hex(rev))
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
193 anc = b.ancestors()
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
194 while len(anc) > 1:
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
195 if not rev in anc:
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
196 ui.warn("failure while bisecting\n")
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
197 sys.exit(1)
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
198 ui.write("it worked :)\n")
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
199 new_rev = b.next()
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
200 ui.write("choosing if good or bad\n")
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
201 if rev in b.ancestors(head=new_rev):
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
202 b.bad(new_rev)
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
203 ui.write("it is bad\n")
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
204 else:
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
205 b.good(new_rev)
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
206 ui.write("it is good\n")
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
207 anc = b.ancestors()
2348
1772852d7d14 better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2305
diff changeset
208 #repo.update(new_rev, force=True)
1367
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
209 for v in anc:
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
210 if v != rev:
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
211 ui.warn("fail to found cset! :(\n")
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
212 return 1
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
213 ui.write("Found bad cset: %s\n" % hg.hex(b.badrev))
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
214 ui.write("Everything is ok :)\n")
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
215 return 0
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
216
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
217 def bisect_run(ui, repo, cmd=None, *args):
4390
052062b98f26 Flesh out bisect help text
Brendan Cully <brendan@kublai.com>
parents: 3891
diff changeset
218 """Dichotomic search in the DAG of changesets
052062b98f26 Flesh out bisect help text
Brendan Cully <brendan@kublai.com>
parents: 3891
diff changeset
219
052062b98f26 Flesh out bisect help text
Brendan Cully <brendan@kublai.com>
parents: 3891
diff changeset
220 This extension helps to find changesets which cause problems.
052062b98f26 Flesh out bisect help text
Brendan Cully <brendan@kublai.com>
parents: 3891
diff changeset
221 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
222 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
223 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
224 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
225 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
226 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
227
052062b98f26 Flesh out bisect help text
Brendan Cully <brendan@kublai.com>
parents: 3891
diff changeset
228 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
229 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
230 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
231
052062b98f26 Flesh out bisect help text
Brendan Cully <brendan@kublai.com>
parents: 3891
diff changeset
232 For subcommands see "hg bisect help\"
1367
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
233 """
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
234 def help_(cmd=None, *args):
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
235 """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
236 cmdtable = bisectcmdtable
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
237 if cmd:
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
238 doc = cmdtable[cmd][0].__doc__
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
239 synopsis = cmdtable[cmd][2]
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
240 ui.write(synopsis + "\n")
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
241 ui.write("\n" + doc + "\n")
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
242 return
2348
1772852d7d14 better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2305
diff changeset
243 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
244 cmds = cmdtable.keys()
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
245 cmds.sort()
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
246 m = max([len(c) for c in cmds])
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
247 for cmd in cmds:
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
248 doc = cmdtable[cmd][0].__doc__.splitlines(0)[0].rstrip()
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
249 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
250
1367
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
251 b = bisect(ui, repo)
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
252 bisectcmdtable = {
2348
1772852d7d14 better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2305
diff changeset
253 "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
254 "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
255 "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
256 "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
257 "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
258 "help": (help_, 1, _("hg bisect help [<subcommand>]")),
1367
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
259 }
1855
0ba9dee8cfbd Fixed spacing/indentation, removed #! script header, added short description.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1854
diff changeset
260
1367
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
261 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
262 ui.warn(_("bisect: Unknown sub-command\n"))
1367
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
263 return help_()
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
264 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
265 ui.warn(_("bisect: Too many arguments\n"))
1367
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
266 return help_()
5322
121816063b9a bisect: remove useless try/except
Patrick Mezard <pmezard@gmail.com>
parents: 5320
diff changeset
267 ret = bisectcmdtable[cmd][0](*args)
121816063b9a bisect: remove useless try/except
Patrick Mezard <pmezard@gmail.com>
parents: 5320
diff changeset
268 b.write()
121816063b9a bisect: remove useless try/except
Patrick Mezard <pmezard@gmail.com>
parents: 5320
diff changeset
269 return ret
1367
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
270
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
271 cmdtable = {
2348
1772852d7d14 better ui for the bisect extension
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 2305
diff changeset
272 "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
273 #"bisect-test": (test, [], "hg bisect-test rev"),
a7678cbd7c28 bisect extension for mercurial
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents:
diff changeset
274 }