# HG changeset patch # User Benoit Boissinot # Date 2008-09-05 08:39:19 # Node ID 55c16f12908b6983c21efc957f77f3b5650c7f0b # Parent 5cf3bf3c19ba7f4076fae55a959bbe59d9674e5c # Parent 6c4a08270222569ba906f4f1c7860783eec19225 merge with crew diff --git a/mercurial/commands.py b/mercurial/commands.py --- a/mercurial/commands.py +++ b/mercurial/commands.py @@ -288,9 +288,6 @@ def bisect(ui, repo, rev=None, extra=Non reset = True elif extra or good + bad + skip + reset > 1: raise util.Abort(_('incompatible arguments')) - elif not (good or bad or skip or reset): - ui.status(_('(no action selected)\n')) - return if reset: p = repo.join("bisect.state") @@ -329,7 +326,12 @@ def bisect(ui, repo, rev=None, extra=Non del wlock if not state['good'] or not state['bad']: - return + if (good or bad or skip or reset): + return + if not state['good']: + raise util.Abort(_('cannot bisect (no known good revisions)')) + else: + raise util.Abort(_('cannot bisect (no known bad revisions)')) # actually bisect nodes, changesets, good = hbisect.bisect(repo.changelog, state) diff --git a/tests/run-tests.py b/tests/run-tests.py --- a/tests/run-tests.py +++ b/tests/run-tests.py @@ -202,6 +202,8 @@ def install_hg(): os.environ["PYTHONPATH"] = pythonpath use_correct_python() + global hgpkg + hgpkg = _hgpath() if coverage: vlog("# Installing coverage wrapper") @@ -456,6 +458,16 @@ BINDIR = os.path.join(INST, "bin") PYTHONDIR = os.path.join(INST, "lib", "python") COVERAGE_FILE = os.path.join(TESTDIR, ".coverage") +def _hgpath(): + cmd = '%s -c "import mercurial; print mercurial.__path__[0]"' + hgpath = os.popen(cmd % python) + path = hgpath.read().strip() + hgpath.close() + return path + +expecthg = os.path.join(HGTMP, 'install', 'lib', 'python', 'mercurial') +hgpkg = None + def run_children(tests): if not options.with_hg: install_hg() @@ -512,6 +524,9 @@ def run_children(tests): print "Skipped %s: %s" % (s[0], s[1]) for s in fails: print "Failed %s: %s" % (s[0], s[1]) + + if hgpkg != expecthg: + print '# Tested unexpected mercurial: %s' % hgpkg print "# Ran %d tests, %d skipped, %d failed." % ( tested, skipped, failed) sys.exit(failures != 0) @@ -525,6 +540,9 @@ def run_tests(tests): if not options.with_hg: install_hg() + if hgpkg != expecthg: + print '# Testing unexpected mercurial: %s' % hgpkg + if options.timeout > 0: try: signal.signal(signal.SIGALRM, alarmed) @@ -585,6 +603,8 @@ def run_tests(tests): print "Skipped %s: %s" % s for s in fails: print "Failed %s: %s" % s + if hgpkg != expecthg: + print '# Tested unexpected mercurial: %s' % hgpkg print "# Ran %d tests, %d skipped, %d failed." % ( tested, skipped, failed) diff --git a/tests/test-bisect b/tests/test-bisect --- a/tests/test-bisect +++ b/tests/test-bisect @@ -55,10 +55,7 @@ hg bisect -g null hg bisect -bU tip hg id -echo % test no action message -hg bisect - -# reproduce AssertionError (issue1228 and issue1182) +echo % reproduce AssertionError, issue1228 and issue1182 hg bisect -r hg bisect -b 4 hg bisect -g 0 @@ -66,8 +63,12 @@ hg bisect -s hg bisect -s hg bisect -s -# reproduce non converging bisect (issue1182) +echo % reproduce non converging bisect, issue1182 hg bisect -r hg bisect -g 0 hg bisect -b 2 hg bisect -s + +echo % test no action +hg bisect -r +hg bisect diff --git a/tests/test-bisect.out b/tests/test-bisect.out --- a/tests/test-bisect.out +++ b/tests/test-bisect.out @@ -241,8 +241,7 @@ abort: Inconsistent state, 31:58c80a7c8a error Testing changeset 15:e7fa0811edb0 (32 changesets remaining, ~5 tests) 5cd978ea5149 -% test no action message -(no action selected) +% reproduce AssertionError, issue1228 and issue1182 Testing changeset 2:db07c04beaca (4 changesets remaining, ~2 tests) 1 files updated, 0 files merged, 0 files removed, 0 files unresolved Testing changeset 1:5cd978ea5149 (4 changesets remaining, ~2 tests) @@ -270,6 +269,7 @@ user: test date: Thu Jan 01 00:00:04 1970 +0000 summary: msg 4 +% reproduce non converging bisect, issue1182 Testing changeset 1:5cd978ea5149 (2 changesets remaining, ~1 tests) 1 files updated, 0 files merged, 0 files removed, 0 files unresolved Due to skipped revisions, the first bad revision could be any of: @@ -283,3 +283,5 @@ user: test date: Thu Jan 01 00:00:02 1970 +0000 summary: msg 2 +% test no action +abort: cannot bisect (no known good revisions)