changeset 9584:17da88da1abd

bisect: use util.system and fix good/bad when using -c The existing scheme using util.find_exe and subprocess.call meant we couldn't use simple shell commands in tests. Fix that. Also, it mistakenly used status from the system() call rather than good from the bisect call in reporting results.
author Matt Mackall <mpm@selenic.com>
date Mon, 12 Oct 2009 18:25:46 -0500
parents 0491be4448bf
children fbed59b61a1c
files mercurial/commands.py tests/test-bisect.out
diffstat 2 files changed, 4 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commands.py	Mon Oct 12 14:59:28 2009 -0500
+++ b/mercurial/commands.py	Mon Oct 12 18:25:46 2009 -0500
@@ -340,14 +340,11 @@
     state = hbisect.load_state(repo)
 
     if command:
-        commandpath = util.find_exe(command)
-        if commandpath is None:
-            raise util.Abort(_("cannot find executable: %s") % command)
         changesets = 1
         try:
             while changesets:
                 # update state
-                status = subprocess.call([commandpath])
+                status = util.system(command)
                 if status == 125:
                     transition = "skip"
                 elif status == 0:
@@ -370,7 +367,7 @@
                 hg.clean(repo, nodes[0], show_stats=False)
         finally:
             hbisect.save_state(repo, state)
-        return print_result(nodes, not status)
+        return print_result(nodes, good)
 
     # update state
     node = repo.lookup(rev or '.')
--- a/tests/test-bisect.out	Mon Oct 12 14:59:28 2009 -0500
+++ b/tests/test-bisect.out	Mon Oct 12 18:25:46 2009 -0500
@@ -304,7 +304,8 @@
 summary:     msg 6
 
 % test invalid command
-abort: cannot find executable: foobar
+/bin/sh: foobar: command not found
+abort: failed to execute 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