tests/test-glog
author Brendan Cully <brendan@kublai.com>
Thu, 12 Jun 2008 00:11:09 -0700
changeset 6664 1e3c1f010808
parent 6385 0d4e068e9e52
child 6969 d76f64cd4cb2
permissions -rwxr-xr-x
Truncate input to 1K when using pygments guess_lexer. This function appears to be exponential with input length.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
4344
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
     1
#!/bin/sh
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
     2
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
     3
# @  (34) head
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
     4
# |
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
     5
# | o  (33) head
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
     6
# | |
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
     7
# o |    (32) expand
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
     8
# |\ \
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
     9
# | o \    (31) expand
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    10
# | |\ \
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    11
# | | o \    (30) expand
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    12
# | | |\ \
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    13
# | | | o |  (29) regular commit
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    14
# | | | | |
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    15
# | | o | |    (28) merge zero known
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    16
# | | |\ \ \
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    17
# o | | | | |  (27) collapse
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    18
# |/ / / / /
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    19
# | | o---+  (26) merge one known; far right
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    20
# | | | | |
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    21
# +---o | |  (25) merge one known; far left
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    22
# | | | | |
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    23
# | | o | |  (24) merge one known; immediate right
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    24
# | | |\| |
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    25
# | | o | |  (23) merge one known; immediate left
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    26
# | |/| | |
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    27
# +---o---+  (22) merge two known; one far left, one far right
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    28
# | |  / /
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    29
# o | | |    (21) expand
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    30
# |\ \ \ \
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    31
# | o---+-+  (20) merge two known; two far right
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    32
# |  / / /
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    33
# o | | |    (19) expand
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    34
# |\ \ \ \
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    35
# +---+---o  (18) merge two known; two far left
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    36
# | | | |
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    37
# | o | |    (17) expand
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    38
# | |\ \ \
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    39
# | | o---+  (16) merge two known; one immediate right, one near right
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    40
# | | |/ /
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    41
# o | | |    (15) expand
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    42
# |\ \ \ \
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    43
# | o-----+  (14) merge two known; one immediate right, one far right
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    44
# | |/ / /
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    45
# o | | |    (13) expand
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    46
# |\ \ \ \
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    47
# +---o | |  (12) merge two known; one immediate right, one far left
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    48
# | | |/ /
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    49
# | o | |    (11) expand
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    50
# | |\ \ \
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    51
# | | o---+  (10) merge two known; one immediate left, one near right
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    52
# | |/ / /
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    53
# o | | |    (9) expand
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    54
# |\ \ \ \
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    55
# | o-----+  (8) merge two known; one immediate left, one far right
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    56
# |/ / / /
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    57
# o | | |    (7) expand
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    58
# |\ \ \ \
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    59
# +---o | |  (6) merge two known; one immediate left, one far left
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    60
# | |/ / /
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    61
# | o | |    (5) expand
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    62
# | |\ \ \
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    63
# | | o | |  (4) merge two known; one immediate left, one immediate right
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    64
# | |/|/ /
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    65
# | o / /  (3) collapse
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    66
# |/ / /
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    67
# o / /  (2) collapse
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    68
# |/ /
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    69
# o /  (1) collapse
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    70
# |/
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    71
# o  (0) root
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    72
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    73
set -e
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    74
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    75
commit()
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    76
{
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    77
    rev=$1
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    78
    msg=$2
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    79
    shift 2
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    80
    if [ "$#" -gt 0 ]; then
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    81
        hg debugsetparents "$@"
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    82
    fi
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    83
    echo $rev > $rev
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    84
    hg add $rev
6385
0d4e068e9e52 commit: when committing the results of a merge, it's all or nothing
Bryan O'Sullivan <bos@serpentine.com>
parents: 6156
diff changeset
    85
    hg rawcommit -q -d "$rev 0" -m "($rev) $msg" $rev
4344
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    86
}
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    87
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    88
echo "[extensions]" >> $HGRCPATH
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    89
echo "graphlog=" >> $HGRCPATH
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    90
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    91
echo % init
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    92
hg init repo
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    93
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    94
cd repo
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    95
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    96
echo % empty repo
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    97
hg glog
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    98
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    99
echo % building tree
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   100
commit 0 "root"
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   101
commit 1 "collapse" 0
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   102
commit 2 "collapse" 1
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   103
commit 3 "collapse" 2
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   104
commit 4 "merge two known; one immediate left, one immediate right" 1 3
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   105
commit 5 "expand" 3 4
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   106
commit 6 "merge two known; one immediate left, one far left" 2 5
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   107
commit 7 "expand" 2 5
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   108
commit 8 "merge two known; one immediate left, one far right" 0 7
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   109
commit 9 "expand" 7 8
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   110
commit 10 "merge two known; one immediate left, one near right" 0 6
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   111
commit 11 "expand" 6 10
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   112
commit 12 "merge two known; one immediate right, one far left" 1 9
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   113
commit 13 "expand" 9 11
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   114
commit 14 "merge two known; one immediate right, one far right" 0 12
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   115
commit 15 "expand" 13 14
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   116
commit 16 "merge two known; one immediate right, one near right" 0 1
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   117
commit 17 "expand" 12 16
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   118
commit 18 "merge two known; two far left" 1 15
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   119
commit 19 "expand" 15 17
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   120
commit 20 "merge two known; two far right" 0 18
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   121
commit 21 "expand" 19 20
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   122
commit 22 "merge two known; one far left, one far right" 18 21
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   123
commit 23 "merge one known; immediate left" 1 22
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   124
commit 24 "merge one known; immediate right" 0 23
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   125
commit 25 "merge one known; far left" 21 24
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   126
commit 26 "merge one known; far right" 18 25
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   127
commit 27 "collapse" 21
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   128
commit 28 "merge zero known" 1 26
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   129
commit 29 "regular commit" 0
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   130
commit 30 "expand" 28 29
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   131
commit 31 "expand" 21 30
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   132
commit 32 "expand" 27 31
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   133
commit 33 "head" 18
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   134
commit 34 "head" 32
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   135
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   136
echo % glog -q
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   137
hg glog -q
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   138
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   139
echo % glog
345ed833854d Add graphlog extension
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   140
hg glog
4735
8d4fac0a9df7 Make hg glog abort if unused arguments are given.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4344
diff changeset
   141
5939
56e8a54bf71d graphlog: add test for filelog graph
Steve Borho <steve@borho.org>
parents: 4735
diff changeset
   142
echo % file glog
56e8a54bf71d graphlog: add test for filelog graph
Steve Borho <steve@borho.org>
parents: 4735
diff changeset
   143
hg glog 5
56e8a54bf71d graphlog: add test for filelog graph
Steve Borho <steve@borho.org>
parents: 4735
diff changeset
   144
4735
8d4fac0a9df7 Make hg glog abort if unused arguments are given.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 4344
diff changeset
   145
echo % unused arguments
5939
56e8a54bf71d graphlog: add test for filelog graph
Steve Borho <steve@borho.org>
parents: 4735
diff changeset
   146
hg glog -q foo bar || echo failed