Merge with crew
authorMatt Mackall <mpm@selenic.com>
Sat, 13 Jun 2009 18:08:51 -0500
changeset 8806 14a0bdd59848
parent 8801 28eaf6f8abce (current diff)
parent 8805 2726a6df11e9 (diff)
child 8807 8bf6eb68ddaf
Merge with crew
mercurial/commands.py
--- a/mercurial/commands.py	Sat Jun 13 18:01:48 2009 -0500
+++ b/mercurial/commands.py	Sat Jun 13 18:08:51 2009 -0500
@@ -339,6 +339,8 @@
 
     if command:
         commandpath = util.find_exe(command)
+        if commandpath is None:
+            raise util.Abort(_("cannot find executable: %s") % command)
         changesets = 1
         try:
             while changesets:
@@ -355,9 +357,9 @@
                     raise util.Abort(_("%s killed") % command)
                 else:
                     transition = "bad"
-                node = repo.lookup(rev or '.')
-                state[transition].append(node)
-                ui.note(_('Changeset %s: %s\n') % (short(node), transition))
+                ctx = repo[rev or '.']
+                state[transition].append(ctx.node())
+                ui.status(_('Changeset %d:%s: %s\n') % (ctx, ctx, transition))
                 check_state(state, interactive=False)
                 # bisect
                 nodes, changesets, good = hbisect.bisect(repo.changelog, state)
--- a/mercurial/dirstate.py	Sat Jun 13 18:01:48 2009 -0500
+++ b/mercurial/dirstate.py	Sat Jun 13 18:08:51 2009 -0500
@@ -473,7 +473,7 @@
 
         # step 1: find all explicit files
         for ff in sorted(files):
-            nf = normalize(normpath(ff), True)
+            nf = normalize(normpath(ff), False)
             if nf in results:
                 continue
 
--- a/tests/test-bisect	Sat Jun 13 18:01:48 2009 -0500
+++ b/tests/test-bisect	Sat Jun 13 18:08:51 2009 -0500
@@ -82,3 +82,25 @@
 hg bisect -s
 hg bisect -s 
 hg bisect -g
+
+set +e
+
+echo % test invalid command
+hg bisect -r
+hg bisect --command 'foobar'
+
+echo % test bisecting command
+cat > script.py <<EOF
+#!/usr/bin/env python
+import sys
+from mercurial import ui, hg
+repo = hg.repository(ui.ui(), '.')
+if repo['.'].rev() < 6:
+    sys.exit(1)
+EOF
+chmod +x script.py
+hg bisect -r
+hg bisect --good tip
+hg bisect --bad 0
+hg bisect --command "`pwd`/script.py"
+true
--- a/tests/test-bisect.out	Sat Jun 13 18:01:48 2009 -0500
+++ b/tests/test-bisect.out	Sat Jun 13 18:08:51 2009 -0500
@@ -303,3 +303,19 @@
 date:        Thu Jan 01 00:00:06 1970 +0000
 summary:     msg 6
 
+% test invalid command
+abort: cannot find executable: foobar
+% test bisecting command
+Testing changeset 15:e7fa0811edb0 (31 changesets remaining, ~4 tests)
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+Changeset 15:e7fa0811edb0: good
+Changeset 7:03750880c6b5: good
+Changeset 3:b53bea5e2fcb: bad
+Changeset 5:7874a09ea728: bad
+Changeset 6:a3d5c6fdf0d3: good
+The first good revision is:
+changeset:   6:a3d5c6fdf0d3
+user:        test
+date:        Thu Jan 01 00:00:06 1970 +0000
+summary:     msg 6
+