[issue1512] hg bisect --command does not work with shell scripts (on Mac at least)
Jonathan Watt
mercurial-bugs at selenic.com
Thu Feb 12 08:02:13 CST 2009
New submission from Jonathan Watt <jwatt at jwatt.org>:
When I try to use a shell script as the command for 'hg bisect --command
<command>', I get presented with an interactive bash sub-shell that blocks hg
until I enter 'exit' as many times as hg takes to finish bisecting. Here is some
test code:
# Create a repository:
mkdir tmp
cd tmp
hg init
echo foo> file
hg add file
hg ci -m "..."
echo bar>> file
hg ci -m "..."
echo baz >> file
hg ci -m "..."
# create 'command' for hg bisect:
echo '#!/bin/bash'> test.sh
echo 'exit 125'>> test.sh
chmod a+x test.sh
# Attempt to run bisect:
hg bisect --reset
hg bisect --bad 0
hg bisect --good 2
hg bisect --command ./test.sh
bash-3.2$ exit
** unknown exception encountered, details follow
** report bug details to http://www.selenic.com/mercurial/bts
** or mercurial at selenic.com
** Mercurial Distributed SCM (version 1.1.1)
** Extensions loaded: fetch, mq, rebase
Traceback (most recent call last):
File "/opt/local/bin/hg", line 20, in <module>
mercurial.dispatch.run()
File "/opt/local/lib/python2.5/site-packages/mercurial/dispatch.py", line 20,
in run
sys.exit(dispatch(sys.argv[1:]))
File "/opt/local/lib/python2.5/site-packages/mercurial/dispatch.py", line 29,
in dispatch
return _runcatch(u, args)
File "/opt/local/lib/python2.5/site-packages/mercurial/dispatch.py", line 45,
in _runcatch
return _dispatch(ui, args)
File "/opt/local/lib/python2.5/site-packages/mercurial/dispatch.py", line 367,
in _dispatch
ret = _runcommand(ui, options, cmd, d)
File "/opt/local/lib/python2.5/site-packages/mercurial/dispatch.py", line 416,
in _runcommand
return checkargs()
File "/opt/local/lib/python2.5/site-packages/mercurial/dispatch.py", line 376,
in checkargs
return cmdfunc()
File "/opt/local/lib/python2.5/site-packages/mercurial/dispatch.py", line 361,
in <lambda>
d = lambda: util.checksignature(func)(ui, *args, **cmdoptions)
File "/opt/local/lib/python2.5/site-packages/mercurial/util.py", line 715, in
check
return func(*args, **kwargs)
File "/opt/local/lib/python2.5/site-packages/mercurial/commands.py", line 354,
in bisect
return print_result(nodes, not status)
UnboundLocalError: local variable 'nodes' referenced before assignment
I've tracked this down to the use of 'os.spawnl' in the function 'bisect' in the
file 'mercurial/commands.py'. Changing that to 'subprocess.call' fixes things,
and 'hg bisect' manages to use the shell script correctly.
----------
messages: 8593
nosy: jwatt
priority: bug
status: unread
title: hg bisect --command does not work with shell scripts (on Mac at least)
____________________________________________________
Mercurial issue tracker <mercurial-bugs at selenic.com>
<http://www.selenic.com/mercurial/bts/issue1512>
____________________________________________________
More information about the Mercurial-devel
mailing list