tests/test-branches
author Martin Geisler <mg@aragost.com>
Fri, 13 Aug 2010 10:13:38 +0200
branchstable
changeset 11834 a86fd45c1911
parent 10417 58e040c51231
permissions -rwxr-xr-x
hgrc.5: fix "hg hg status" -> "hg status"
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
10417
58e040c51231 branch: avoid using reserved tag names
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 8991
diff changeset
    39
hg branch tip
58e040c51231 branch: avoid using reserved tag names
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 8991
diff changeset
    40
hg branch null
58e040c51231 branch: avoid using reserved tag names
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 8991
diff changeset
    41
hg branch .
58e040c51231 branch: avoid using reserved tag names
Wagner Bruna <wbruna@softwareexpress.com.br>
parents: 8991
diff changeset
    42
6631
a2b13cac0922 Active branches fix (issue1104)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6067
diff changeset
    43
echo 'd' >d
a2b13cac0922 Active branches fix (issue1104)
Stefano Tortarolo <stefano.tortarolo@gmail.com>
parents: 6067
diff changeset
    44
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
    45
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
    46
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
    47
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
    48
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
    49
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
    50
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
    51
57c1a7052982 Option to log to only show changesets within a specified branch.
Dustin Sallings <dustin@spy.net>
parents: 4675
diff changeset
    52
echo "--- Branch a"
57c1a7052982 Option to log to only show changesets within a specified branch.
Dustin Sallings <dustin@spy.net>
parents: 4675
diff changeset
    53
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
    54
57c1a7052982 Option to log to only show changesets within a specified branch.
Dustin Sallings <dustin@spy.net>
parents: 4675
diff changeset
    55
echo "---- Branch b"
57c1a7052982 Option to log to only show changesets within a specified branch.
Dustin Sallings <dustin@spy.net>
parents: 4675
diff changeset
    56
hg log -b b
7657
405cacb06745 branch closing: add test for branch closing (and reopening)
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 7006
diff changeset
    57
405cacb06745 branch closing: add test for branch closing (and reopening)
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 7006
diff changeset
    58
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
    59
hg branches
405cacb06745 branch closing: add test for branch closing (and reopening)
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 7006
diff changeset
    60
hg up -C b
405cacb06745 branch closing: add test for branch closing (and reopening)
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 7006
diff changeset
    61
echo 'xxx1' >> b
8168
8766fee6f225 tests: removed redundant "-u test" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 7657
diff changeset
    62
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
    63
hg up -C aee39cd168d0
405cacb06745 branch closing: add test for branch closing (and reopening)
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 7006
diff changeset
    64
echo 'xxx2' >> b
8168
8766fee6f225 tests: removed redundant "-u test" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 7657
diff changeset
    65
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
    66
echo 'xxx3' >> b
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' -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
    68
hg branches
8695
9a89253a32e6 heads: show closed heads only when --closed is passed
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 8168
diff changeset
    69
hg heads --closed
7657
405cacb06745 branch closing: add test for branch closing (and reopening)
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 7006
diff changeset
    70
hg heads
8168
8766fee6f225 tests: removed redundant "-u test" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 7657
diff changeset
    71
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
    72
hg branches -a
405cacb06745 branch closing: add test for branch closing (and reopening)
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 7006
diff changeset
    73
hg up -C b
8168
8766fee6f225 tests: removed redundant "-u test" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 7657
diff changeset
    74
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
    75
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
    76
hg branches
8991
7e0b31dfc66f branches: add --closed flag for consistency with heads
Matt Mackall <mpm@selenic.com>
parents: 8796
diff changeset
    77
hg branches -c
7657
405cacb06745 branch closing: add test for branch closing (and reopening)
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 7006
diff changeset
    78
hg branches -a
8796
2bcef677a6c3 localrepo: remove 'closed' argument to heads(...) function
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 8695
diff changeset
    79
hg heads b
2bcef677a6c3 localrepo: remove 'closed' argument to heads(...) function
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 8695
diff changeset
    80
hg heads --closed b
7657
405cacb06745 branch closing: add test for branch closing (and reopening)
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 7006
diff changeset
    81
echo 'xxx4' >> b
8168
8766fee6f225 tests: removed redundant "-u test" from test scripts
Martin Geisler <mg@lazybytes.net>
parents: 7657
diff changeset
    82
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
    83
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
    84
hg branches -a
8796
2bcef677a6c3 localrepo: remove 'closed' argument to heads(...) function
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 8695
diff changeset
    85
echo '---- test heads listings'
7657
405cacb06745 branch closing: add test for branch closing (and reopening)
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 7006
diff changeset
    86
hg heads
8796
2bcef677a6c3 localrepo: remove 'closed' argument to heads(...) function
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 8695
diff changeset
    87
echo '% branch default'
2bcef677a6c3 localrepo: remove 'closed' argument to heads(...) function
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 8695
diff changeset
    88
hg heads default
2bcef677a6c3 localrepo: remove 'closed' argument to heads(...) function
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 8695
diff changeset
    89
echo '% branch a'
2bcef677a6c3 localrepo: remove 'closed' argument to heads(...) function
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 8695
diff changeset
    90
hg heads a
2bcef677a6c3 localrepo: remove 'closed' argument to heads(...) function
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 8695
diff changeset
    91
hg heads --active a
2bcef677a6c3 localrepo: remove 'closed' argument to heads(...) function
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 8695
diff changeset
    92
echo '% branch b'
2bcef677a6c3 localrepo: remove 'closed' argument to heads(...) function
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 8695
diff changeset
    93
hg heads b
2bcef677a6c3 localrepo: remove 'closed' argument to heads(...) function
John Mulligan <phlogistonjohn@asynchrono.us>
parents: 8695
diff changeset
    94
hg heads --closed b