tests/test-branches
author Nicolas Dumazet <nicdumz.commits@gmail.com>
Sat, 03 Jul 2010 18:11:15 +0900
changeset 11608 183e63112698
parent 10417 58e040c51231
permissions -rwxr-xr-x
log: remove increasing windows usage in fastpath The purpose of increasing windows is to allow backwards iteration on the filelog at a reasonable cost. But is it needed? - if follow is False, we have no reason to iterate backwards. We basically just want to walk the complete filelog and yield all revisions within the revision range. We can do this forward or backwards, as it only reads the index. - when follow is True, we need to examine the contents of the filelog, and to do this efficiently we need to read the filelog forward. And on the other hand, to track ancestors and copies, we need to process revisions backwards. But is it necessary to use increasing windows for this? We can iterate over the complete filelog forward, stack the revisions, and read the reversed(pile), it does the same thing with a more readable code.
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