tests/test-branches
author Jim Hague <jim.hague@acm.org>
Wed, 06 Jan 2010 18:03:33 +0000
branchstable
changeset 10253 b190a8125b43
parent 8991 7e0b31dfc66f
child 10417 58e040c51231
permissions -rwxr-xr-x
Work around AIX shell builtin printf not handling \NNN. On AIX, ksh builtin printf does not understand \NNN. Some tests use this to generate test data, and so fail on AIX. Rework these tests to use python to generate the correct characters. This fixes the tests on AIX and should be more generally portable.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4675
6858a7477a5e Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
     1
#!/bin/sh
6858a7477a5e Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
     2
6858a7477a5e Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
     3
hg init a
6858a7477a5e Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
     4
cd a
6858a7477a5e Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
     5
echo 'root' >root
6858a7477a5e Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
     6
hg add root
8168
8766fee6f225 tests: removed redundant "-u test" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 7657
diff changeset
     7
hg commit -d '0 0' -m "Adding root node"
4675
6858a7477a5e Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
     8
6858a7477a5e Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
     9
echo 'a' >a
6858a7477a5e Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    10
hg add a
6858a7477a5e Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    11
hg branch a
8168
8766fee6f225 tests: removed redundant "-u test" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 7657
diff changeset
    12
hg commit -d '1 0' -m "Adding a branch"
4675
6858a7477a5e Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    13
7006
92d44ec32430 branch: added more support for named branches
Sune Foldager <cryo@cyanite.org>
parents: 6815
diff changeset
    14
hg branch q
92d44ec32430 branch: added more support for named branches
Sune Foldager <cryo@cyanite.org>
parents: 6815
diff changeset
    15
echo 'aa' >a
92d44ec32430 branch: added more support for named branches
Sune Foldager <cryo@cyanite.org>
parents: 6815
diff changeset
    16
hg branch -C
8168
8766fee6f225 tests: removed redundant "-u test" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 7657
diff changeset
    17
hg commit -d '2 0' -m "Adding to a branch"
7006
92d44ec32430 branch: added more support for named branches
Sune Foldager <cryo@cyanite.org>
parents: 6815
diff changeset
    18
4675
6858a7477a5e Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    19
hg update -C 0
6858a7477a5e Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    20
echo 'b' >b
6858a7477a5e Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    21
hg add b
6858a7477a5e Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    22
hg branch b
8168
8766fee6f225 tests: removed redundant "-u test" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 7657
diff changeset
    23
hg commit -d '2 0' -m "Adding b branch"
4675
6858a7477a5e Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    24
6858a7477a5e Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    25
echo 'bh1' >bh1
6858a7477a5e Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    26
hg add bh1
8168
8766fee6f225 tests: removed redundant "-u test" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 7657
diff changeset
    27
hg commit -d '3 0' -m "Adding b branch head 1"
4675
6858a7477a5e Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    28
6858a7477a5e Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    29
hg update -C 2
6858a7477a5e Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    30
echo 'bh2' >bh2
6858a7477a5e Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    31
hg add bh2
8168
8766fee6f225 tests: removed redundant "-u test" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 7657
diff changeset
    32
hg commit -d '4 0' -m "Adding b branch head 2"
4675
6858a7477a5e Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    33
6858a7477a5e Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    34
echo 'c' >c
6858a7477a5e Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    35
hg add c
6858a7477a5e Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    36
hg branch c
8168
8766fee6f225 tests: removed redundant "-u test" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 7657
diff changeset
    37
hg commit -d '5 0' -m "Adding c branch"
4675
6858a7477a5e Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    38
6631
a2b13cac0922 Active branches fix (issue1104)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6067
diff changeset
    39
echo 'd' >d
a2b13cac0922 Active branches fix (issue1104)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6067
diff changeset
    40
hg add d
6815
7d6622eaad08 test-branches: add a test for long branch name (issue 1230)
Patrick Mezard <pmezard@gmail.com>
parents: 6631
diff changeset
    41
hg branch 'a branch name much longer than the default justification used by branches'
8168
8766fee6f225 tests: removed redundant "-u test" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 7657
diff changeset
    42
hg commit -d '6 0' -m "Adding d branch"
6631
a2b13cac0922 Active branches fix (issue1104)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6067
diff changeset
    43
4675
6858a7477a5e Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    44
hg branches
6858a7477a5e Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    45
echo '-------'
6858a7477a5e Change branches to sort 'active' branches first, and add an option to show only active branches.
Eric Hopper <hopper@omnifarious.org>
parents:
diff changeset
    46
hg branches -a
6067
57c1a7052982 Option to log to only show changesets within a specified branch.
Dustin Sallings <dustin@spy.net>
parents: 4675
diff changeset
    47
57c1a7052982 Option to log to only show changesets within a specified branch.
Dustin Sallings <dustin@spy.net>
parents: 4675
diff changeset
    48
echo "--- Branch a"
57c1a7052982 Option to log to only show changesets within a specified branch.
Dustin Sallings <dustin@spy.net>
parents: 4675
diff changeset
    49
hg log -b a
57c1a7052982 Option to log to only show changesets within a specified branch.
Dustin Sallings <dustin@spy.net>
parents: 4675
diff changeset
    50
57c1a7052982 Option to log to only show changesets within a specified branch.
Dustin Sallings <dustin@spy.net>
parents: 4675
diff changeset
    51
echo "---- Branch b"
57c1a7052982 Option to log to only show changesets within a specified branch.
Dustin Sallings <dustin@spy.net>
parents: 4675
diff changeset
    52
hg log -b b
7657
405cacb06745 branch closing: add test for branch closing (and reopening)
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 7006
diff changeset
    53
405cacb06745 branch closing: add test for branch closing (and reopening)
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 7006
diff changeset
    54
echo "---- going to test branch closing"
405cacb06745 branch closing: add test for branch closing (and reopening)
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 7006
diff changeset
    55
hg branches
405cacb06745 branch closing: add test for branch closing (and reopening)
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 7006
diff changeset
    56
hg up -C b
405cacb06745 branch closing: add test for branch closing (and reopening)
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 7006
diff changeset
    57
echo 'xxx1' >> b
8168
8766fee6f225 tests: removed redundant "-u test" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 7657
diff changeset
    58
hg commit -d '7 0' -m 'adding cset to branch b'
7657
405cacb06745 branch closing: add test for branch closing (and reopening)
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 7006
diff changeset
    59
hg up -C aee39cd168d0
405cacb06745 branch closing: add test for branch closing (and reopening)
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 7006
diff changeset
    60
echo 'xxx2' >> b
8168
8766fee6f225 tests: removed redundant "-u test" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 7657
diff changeset
    61
hg commit -d '8 0' -m 'adding head to branch b'
7657
405cacb06745 branch closing: add test for branch closing (and reopening)
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 7006
diff changeset
    62
echo 'xxx3' >> b
8168
8766fee6f225 tests: removed redundant "-u test" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 7657
diff changeset
    63
hg commit -d '9 0' -m 'adding another cset to branch b'
7657
405cacb06745 branch closing: add test for branch closing (and reopening)
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 7006
diff changeset
    64
hg branches
8695
9a89253a32e6 heads: show closed heads only when --closed is passed
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 8168
diff changeset
    65
hg heads --closed
7657
405cacb06745 branch closing: add test for branch closing (and reopening)
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 7006
diff changeset
    66
hg heads
8168
8766fee6f225 tests: removed redundant "-u test" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 7657
diff changeset
    67
hg commit -d '9 0' --close-branch -m 'prune bad branch'
7657
405cacb06745 branch closing: add test for branch closing (and reopening)
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 7006
diff changeset
    68
hg branches -a
405cacb06745 branch closing: add test for branch closing (and reopening)
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 7006
diff changeset
    69
hg up -C b
8168
8766fee6f225 tests: removed redundant "-u test" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 7657
diff changeset
    70
hg commit -d '9 0' --close-branch -m 'close this part branch too'
7657
405cacb06745 branch closing: add test for branch closing (and reopening)
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 7006
diff changeset
    71
echo '--- b branch should be inactive'
405cacb06745 branch closing: add test for branch closing (and reopening)
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 7006
diff changeset
    72
hg branches
8991
7e0b31dfc66f branches: add --closed flag for consistency with heads
Matt Mackall <mpm@selenic.com>
parents: 8796
diff changeset
    73
hg branches -c
7657
405cacb06745 branch closing: add test for branch closing (and reopening)
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 7006
diff changeset
    74
hg branches -a
8796
2bcef677a6c3 localrepo: remove 'closed' argument to heads(...) function
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 8695
diff changeset
    75
hg heads b
2bcef677a6c3 localrepo: remove 'closed' argument to heads(...) function
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 8695
diff changeset
    76
hg heads --closed b
7657
405cacb06745 branch closing: add test for branch closing (and reopening)
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 7006
diff changeset
    77
echo 'xxx4' >> b
8168
8766fee6f225 tests: removed redundant "-u test" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 7657
diff changeset
    78
hg commit -d '9 0' -m 'reopen branch with a change'
7657
405cacb06745 branch closing: add test for branch closing (and reopening)
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 7006
diff changeset
    79
echo '--- branch b is back in action'
405cacb06745 branch closing: add test for branch closing (and reopening)
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 7006
diff changeset
    80
hg branches -a
8796
2bcef677a6c3 localrepo: remove 'closed' argument to heads(...) function
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 8695
diff changeset
    81
echo '---- test heads listings'
7657
405cacb06745 branch closing: add test for branch closing (and reopening)
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 7006
diff changeset
    82
hg heads
8796
2bcef677a6c3 localrepo: remove 'closed' argument to heads(...) function
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 8695
diff changeset
    83
echo '% branch default'
2bcef677a6c3 localrepo: remove 'closed' argument to heads(...) function
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 8695
diff changeset
    84
hg heads default
2bcef677a6c3 localrepo: remove 'closed' argument to heads(...) function
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 8695
diff changeset
    85
echo '% branch a'
2bcef677a6c3 localrepo: remove 'closed' argument to heads(...) function
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 8695
diff changeset
    86
hg heads a
2bcef677a6c3 localrepo: remove 'closed' argument to heads(...) function
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 8695
diff changeset
    87
hg heads --active a
2bcef677a6c3 localrepo: remove 'closed' argument to heads(...) function
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 8695
diff changeset
    88
echo '% branch b'
2bcef677a6c3 localrepo: remove 'closed' argument to heads(...) function
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 8695
diff changeset
    89
hg heads b
2bcef677a6c3 localrepo: remove 'closed' argument to heads(...) function
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 8695
diff changeset
    90
hg heads --closed b