tests/test-bisect
author Brodie Rao <me+hg@dackz.net>
Tue, 30 Jun 2009 17:58:17 -0400
changeset 8982 9c0cecb71350
parent 8803 2b35ced86b69
child 9692 807633f1e3c2
permissions -rwxr-xr-x
zsh completion: disable defaults and verbose output when completing If ui.verbose is set to True in hgrc, commands used to provide completions would yield bad results. For example, qpush completion would include the patch numbers and statuses as returned by qunapplied -v, instead of just the patch names. Defaults are also disabled when completing to prevent similar issues when an option is set that changes a command's output.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2924
d62ce27d925a tests: new test for the bisect extension
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
     1
#!/bin/sh
d62ce27d925a tests: new test for the bisect extension
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
     2
d62ce27d925a tests: new test for the bisect extension
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
     3
set -e
d62ce27d925a tests: new test for the bisect extension
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
     4
d62ce27d925a tests: new test for the bisect extension
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
     5
echo % init
d62ce27d925a tests: new test for the bisect extension
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
     6
hg init
d62ce27d925a tests: new test for the bisect extension
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
     7
d62ce27d925a tests: new test for the bisect extension
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
     8
echo % committing changes
d62ce27d925a tests: new test for the bisect extension
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
     9
count=0
d62ce27d925a tests: new test for the bisect extension
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    10
echo > a
d62ce27d925a tests: new test for the bisect extension
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    11
while test $count -lt 32 ; do
d62ce27d925a tests: new test for the bisect extension
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    12
    echo 'a' >> a
d62ce27d925a tests: new test for the bisect extension
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    13
    test $count -eq 0 && hg add
d62ce27d925a tests: new test for the bisect extension
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    14
    hg ci -m "msg $count" -d "$count 0"
d62ce27d925a tests: new test for the bisect extension
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    15
    echo % committed changeset $count
2932
d77022db1bca Solaris portability fixes
Danek Duvall <danek.duvall@sun.com>
parents: 2925
diff changeset
    16
    count=`expr $count + 1`
2924
d62ce27d925a tests: new test for the bisect extension
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    17
done
d62ce27d925a tests: new test for the bisect extension
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    18
d62ce27d925a tests: new test for the bisect extension
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    19
echo % log
d62ce27d925a tests: new test for the bisect extension
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    20
hg log
d62ce27d925a tests: new test for the bisect extension
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    21
d62ce27d925a tests: new test for the bisect extension
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    22
echo % hg up -C
d62ce27d925a tests: new test for the bisect extension
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    23
hg up -C
d62ce27d925a tests: new test for the bisect extension
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    24
d62ce27d925a tests: new test for the bisect extension
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents:
diff changeset
    25
echo % bisect test
5735
9079081b8982 bisect: use more standard command syntax and help
Matt Mackall <mpm@selenic.com>
parents: 2990
diff changeset
    26
hg bisect -r
9079081b8982 bisect: use more standard command syntax and help
Matt Mackall <mpm@selenic.com>
parents: 2990
diff changeset
    27
hg bisect -b
9079081b8982 bisect: use more standard command syntax and help
Matt Mackall <mpm@selenic.com>
parents: 2990
diff changeset
    28
hg bisect -g 1
9079081b8982 bisect: use more standard command syntax and help
Matt Mackall <mpm@selenic.com>
parents: 2990
diff changeset
    29
hg bisect -g
5777
51776e50bc8c bisect: improve tests
Matt Mackall <mpm@selenic.com>
parents: 5776
diff changeset
    30
echo skip
51776e50bc8c bisect: improve tests
Matt Mackall <mpm@selenic.com>
parents: 5776
diff changeset
    31
hg bisect -s
5735
9079081b8982 bisect: use more standard command syntax and help
Matt Mackall <mpm@selenic.com>
parents: 2990
diff changeset
    32
hg bisect -g
9079081b8982 bisect: use more standard command syntax and help
Matt Mackall <mpm@selenic.com>
parents: 2990
diff changeset
    33
hg bisect -g
9079081b8982 bisect: use more standard command syntax and help
Matt Mackall <mpm@selenic.com>
parents: 2990
diff changeset
    34
hg bisect -b
9079081b8982 bisect: use more standard command syntax and help
Matt Mackall <mpm@selenic.com>
parents: 2990
diff changeset
    35
hg bisect -g
5776
35ec669cdd43 bisect: handle search for bad to good transitions
Matt Mackall <mpm@selenic.com>
parents: 5775
diff changeset
    36
35ec669cdd43 bisect: handle search for bad to good transitions
Matt Mackall <mpm@selenic.com>
parents: 5775
diff changeset
    37
echo % bisect reverse test
35ec669cdd43 bisect: handle search for bad to good transitions
Matt Mackall <mpm@selenic.com>
parents: 5775
diff changeset
    38
hg bisect -r
35ec669cdd43 bisect: handle search for bad to good transitions
Matt Mackall <mpm@selenic.com>
parents: 5775
diff changeset
    39
hg bisect -b null
35ec669cdd43 bisect: handle search for bad to good transitions
Matt Mackall <mpm@selenic.com>
parents: 5775
diff changeset
    40
hg bisect -g tip
35ec669cdd43 bisect: handle search for bad to good transitions
Matt Mackall <mpm@selenic.com>
parents: 5775
diff changeset
    41
hg bisect -g
5777
51776e50bc8c bisect: improve tests
Matt Mackall <mpm@selenic.com>
parents: 5776
diff changeset
    42
echo skip
51776e50bc8c bisect: improve tests
Matt Mackall <mpm@selenic.com>
parents: 5776
diff changeset
    43
hg bisect -s
5776
35ec669cdd43 bisect: handle search for bad to good transitions
Matt Mackall <mpm@selenic.com>
parents: 5775
diff changeset
    44
hg bisect -g
35ec669cdd43 bisect: handle search for bad to good transitions
Matt Mackall <mpm@selenic.com>
parents: 5775
diff changeset
    45
hg bisect -g
35ec669cdd43 bisect: handle search for bad to good transitions
Matt Mackall <mpm@selenic.com>
parents: 5775
diff changeset
    46
hg bisect -b
35ec669cdd43 bisect: handle search for bad to good transitions
Matt Mackall <mpm@selenic.com>
parents: 5775
diff changeset
    47
hg bisect -g
5777
51776e50bc8c bisect: improve tests
Matt Mackall <mpm@selenic.com>
parents: 5776
diff changeset
    48
51776e50bc8c bisect: improve tests
Matt Mackall <mpm@selenic.com>
parents: 5776
diff changeset
    49
hg bisect -r
51776e50bc8c bisect: improve tests
Matt Mackall <mpm@selenic.com>
parents: 5776
diff changeset
    50
hg bisect -g tip
51776e50bc8c bisect: improve tests
Matt Mackall <mpm@selenic.com>
parents: 5776
diff changeset
    51
hg bisect -b tip || echo error
51776e50bc8c bisect: improve tests
Matt Mackall <mpm@selenic.com>
parents: 5776
diff changeset
    52
51776e50bc8c bisect: improve tests
Matt Mackall <mpm@selenic.com>
parents: 5776
diff changeset
    53
hg bisect -r
51776e50bc8c bisect: improve tests
Matt Mackall <mpm@selenic.com>
parents: 5776
diff changeset
    54
hg bisect -g null
51776e50bc8c bisect: improve tests
Matt Mackall <mpm@selenic.com>
parents: 5776
diff changeset
    55
hg bisect -bU tip
6860
6d904eb19c2a add additional bisect tests
Bernhard Leiner <bleiner@gmail.com>
parents: 5777
diff changeset
    56
hg id
6d904eb19c2a add additional bisect tests
Bernhard Leiner <bleiner@gmail.com>
parents: 5777
diff changeset
    57
6983
5ce625983208 bisect: only complain when nothing can be done
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6929
diff changeset
    58
echo % reproduce AssertionError, issue1228 and issue1182
6860
6d904eb19c2a add additional bisect tests
Bernhard Leiner <bleiner@gmail.com>
parents: 5777
diff changeset
    59
hg bisect -r
6d904eb19c2a add additional bisect tests
Bernhard Leiner <bleiner@gmail.com>
parents: 5777
diff changeset
    60
hg bisect -b 4
6d904eb19c2a add additional bisect tests
Bernhard Leiner <bleiner@gmail.com>
parents: 5777
diff changeset
    61
hg bisect -g 0
6d904eb19c2a add additional bisect tests
Bernhard Leiner <bleiner@gmail.com>
parents: 5777
diff changeset
    62
hg bisect -s
6d904eb19c2a add additional bisect tests
Bernhard Leiner <bleiner@gmail.com>
parents: 5777
diff changeset
    63
hg bisect -s
6d904eb19c2a add additional bisect tests
Bernhard Leiner <bleiner@gmail.com>
parents: 5777
diff changeset
    64
hg bisect -s
6d904eb19c2a add additional bisect tests
Bernhard Leiner <bleiner@gmail.com>
parents: 5777
diff changeset
    65
6983
5ce625983208 bisect: only complain when nothing can be done
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6929
diff changeset
    66
echo % reproduce non converging bisect, issue1182
6860
6d904eb19c2a add additional bisect tests
Bernhard Leiner <bleiner@gmail.com>
parents: 5777
diff changeset
    67
hg bisect -r
6d904eb19c2a add additional bisect tests
Bernhard Leiner <bleiner@gmail.com>
parents: 5777
diff changeset
    68
hg bisect -g 0
6d904eb19c2a add additional bisect tests
Bernhard Leiner <bleiner@gmail.com>
parents: 5777
diff changeset
    69
hg bisect -b 2
6d904eb19c2a add additional bisect tests
Bernhard Leiner <bleiner@gmail.com>
parents: 5777
diff changeset
    70
hg bisect -s
6983
5ce625983208 bisect: only complain when nothing can be done
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6929
diff changeset
    71
5ce625983208 bisect: only complain when nothing can be done
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6929
diff changeset
    72
echo % test no action
5ce625983208 bisect: only complain when nothing can be done
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents: 6929
diff changeset
    73
hg bisect -r
6990
ca6103c5eefd fix test-bisect error (because of set -e)
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 6983
diff changeset
    74
hg bisect || echo failure
7557
21233de9c053 Circumvent removal of valid bisect candidates due to previously skipped ones
Bernhard Leiner <bleiner@gmail.com>
parents: 6990
diff changeset
    75
21233de9c053 Circumvent removal of valid bisect candidates due to previously skipped ones
Bernhard Leiner <bleiner@gmail.com>
parents: 6990
diff changeset
    76
echo % reproduce AssertionError, issue1445
21233de9c053 Circumvent removal of valid bisect candidates due to previously skipped ones
Bernhard Leiner <bleiner@gmail.com>
parents: 6990
diff changeset
    77
hg bisect -r
21233de9c053 Circumvent removal of valid bisect candidates due to previously skipped ones
Bernhard Leiner <bleiner@gmail.com>
parents: 6990
diff changeset
    78
hg bisect -b 6
21233de9c053 Circumvent removal of valid bisect candidates due to previously skipped ones
Bernhard Leiner <bleiner@gmail.com>
parents: 6990
diff changeset
    79
hg bisect -g 0
21233de9c053 Circumvent removal of valid bisect candidates due to previously skipped ones
Bernhard Leiner <bleiner@gmail.com>
parents: 6990
diff changeset
    80
hg bisect -s
21233de9c053 Circumvent removal of valid bisect candidates due to previously skipped ones
Bernhard Leiner <bleiner@gmail.com>
parents: 6990
diff changeset
    81
hg bisect -s
21233de9c053 Circumvent removal of valid bisect candidates due to previously skipped ones
Bernhard Leiner <bleiner@gmail.com>
parents: 6990
diff changeset
    82
hg bisect -s
21233de9c053 Circumvent removal of valid bisect candidates due to previously skipped ones
Bernhard Leiner <bleiner@gmail.com>
parents: 6990
diff changeset
    83
hg bisect -s 
21233de9c053 Circumvent removal of valid bisect candidates due to previously skipped ones
Bernhard Leiner <bleiner@gmail.com>
parents: 6990
diff changeset
    84
hg bisect -g
8802
ca14b3982ffe bisect: fix traceback when command executable is not found
Patrick Mezard <pmezard@gmail.com>
parents: 7557
diff changeset
    85
8803
2b35ced86b69 test-bisect: test --command option
Patrick Mezard <pmezard@gmail.com>
parents: 8802
diff changeset
    86
set +e
2b35ced86b69 test-bisect: test --command option
Patrick Mezard <pmezard@gmail.com>
parents: 8802
diff changeset
    87
8802
ca14b3982ffe bisect: fix traceback when command executable is not found
Patrick Mezard <pmezard@gmail.com>
parents: 7557
diff changeset
    88
echo % test invalid command
ca14b3982ffe bisect: fix traceback when command executable is not found
Patrick Mezard <pmezard@gmail.com>
parents: 7557
diff changeset
    89
hg bisect -r
ca14b3982ffe bisect: fix traceback when command executable is not found
Patrick Mezard <pmezard@gmail.com>
parents: 7557
diff changeset
    90
hg bisect --command 'foobar'
8803
2b35ced86b69 test-bisect: test --command option
Patrick Mezard <pmezard@gmail.com>
parents: 8802
diff changeset
    91
2b35ced86b69 test-bisect: test --command option
Patrick Mezard <pmezard@gmail.com>
parents: 8802
diff changeset
    92
echo % test bisecting command
2b35ced86b69 test-bisect: test --command option
Patrick Mezard <pmezard@gmail.com>
parents: 8802
diff changeset
    93
cat > script.py <<EOF
2b35ced86b69 test-bisect: test --command option
Patrick Mezard <pmezard@gmail.com>
parents: 8802
diff changeset
    94
#!/usr/bin/env python
2b35ced86b69 test-bisect: test --command option
Patrick Mezard <pmezard@gmail.com>
parents: 8802
diff changeset
    95
import sys
2b35ced86b69 test-bisect: test --command option
Patrick Mezard <pmezard@gmail.com>
parents: 8802
diff changeset
    96
from mercurial import ui, hg
2b35ced86b69 test-bisect: test --command option
Patrick Mezard <pmezard@gmail.com>
parents: 8802
diff changeset
    97
repo = hg.repository(ui.ui(), '.')
2b35ced86b69 test-bisect: test --command option
Patrick Mezard <pmezard@gmail.com>
parents: 8802
diff changeset
    98
if repo['.'].rev() < 6:
2b35ced86b69 test-bisect: test --command option
Patrick Mezard <pmezard@gmail.com>
parents: 8802
diff changeset
    99
    sys.exit(1)
2b35ced86b69 test-bisect: test --command option
Patrick Mezard <pmezard@gmail.com>
parents: 8802
diff changeset
   100
EOF
2b35ced86b69 test-bisect: test --command option
Patrick Mezard <pmezard@gmail.com>
parents: 8802
diff changeset
   101
chmod +x script.py
2b35ced86b69 test-bisect: test --command option
Patrick Mezard <pmezard@gmail.com>
parents: 8802
diff changeset
   102
hg bisect -r
2b35ced86b69 test-bisect: test --command option
Patrick Mezard <pmezard@gmail.com>
parents: 8802
diff changeset
   103
hg bisect --good tip
2b35ced86b69 test-bisect: test --command option
Patrick Mezard <pmezard@gmail.com>
parents: 8802
diff changeset
   104
hg bisect --bad 0
2b35ced86b69 test-bisect: test --command option
Patrick Mezard <pmezard@gmail.com>
parents: 8802
diff changeset
   105
hg bisect --command "`pwd`/script.py"
2b35ced86b69 test-bisect: test --command option
Patrick Mezard <pmezard@gmail.com>
parents: 8802
diff changeset
   106
true