tests/test-bookmarks
author Matt Mackall <mpm@selenic.com>
Sat, 19 Jun 2010 12:22:35 -0500
changeset 11404 37cbedbeae96
parent 11282 e581f3acc338
child 11704 18c47562d331
permissions -rwxr-xr-x
revset: allow extended characters in symbols
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7261
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
     1
#!/bin/sh
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
     2
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
     3
echo "[extensions]" >> $HGRCPATH
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
     4
echo "bookmarks=" >> $HGRCPATH
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
     5
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
     6
hg init
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
     7
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
     8
echo % no bookmarks
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
     9
hg bookmarks
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    10
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    11
echo % bookmark rev -1
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    12
hg bookmark X
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    13
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    14
echo % list bookmarks
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    15
hg bookmarks
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    16
10826
717c35d55fb3 color: colorize based on output labels instead of parsing output
Brodie Rao <brodie@bitheap.org>
parents: 7261
diff changeset
    17
echo % list bookmarks with color
11141
df5d1d571d27 tests: force color ansi mode on Windows
Patrick Mezard <pmezard@gmail.com>
parents: 10826
diff changeset
    18
hg --config extensions.color= --config color.mode=ansi \
df5d1d571d27 tests: force color ansi mode on Windows
Patrick Mezard <pmezard@gmail.com>
parents: 10826
diff changeset
    19
    bookmarks --color=always
10826
717c35d55fb3 color: colorize based on output labels instead of parsing output
Brodie Rao <brodie@bitheap.org>
parents: 7261
diff changeset
    20
7261
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    21
echo a > a
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    22
hg add a
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    23
hg commit -m 0
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    24
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    25
echo % bookmark X moved to rev 0
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    26
hg bookmarks
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    27
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    28
echo % look up bookmark
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    29
hg log -r X
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    30
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    31
echo % second bookmark for rev 0
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    32
hg bookmark X2
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    33
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    34
echo % bookmark rev -1 again
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    35
hg bookmark -r null Y
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    36
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    37
echo % list bookmarks
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    38
hg bookmarks
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    39
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    40
echo b > b
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    41
hg add b
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    42
hg commit -m 1
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    43
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    44
echo % bookmarks X and X2 moved to rev 1, Y at rev -1
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    45
hg bookmarks
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    46
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    47
echo % bookmark rev 0 again
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    48
hg bookmark -r 0 Z
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    49
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    50
echo c > c
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    51
hg add c
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    52
hg commit -m 2
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    53
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    54
echo % bookmarks X and X2 moved to rev 2, Y at rev -1, Z at rev 0
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    55
hg bookmarks
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    56
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    57
echo % rename nonexistent bookmark
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    58
hg bookmark -m A B
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    59
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    60
echo % rename to existent bookmark
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    61
hg bookmark -m X Y
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    62
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    63
echo % force rename to existent bookmark
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    64
hg bookmark -f -m X Y
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    65
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    66
echo % list bookmarks
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    67
hg bookmark
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    68
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    69
echo % rename without new name
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    70
hg bookmark -m Y
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    71
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    72
echo % delete without name
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    73
hg bookmark -d
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    74
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    75
echo % delete nonexistent bookmark
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    76
hg bookmark -d A
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    77
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    78
echo % bookmark name with spaces should be stripped
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    79
hg bookmark ' x  y '
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    80
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    81
echo % list bookmarks
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    82
hg bookmarks
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    83
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    84
echo % look up stripped bookmark name
11282
e581f3acc338 revset: fix up tests
Matt Mackall <mpm@selenic.com>
parents: 11141
diff changeset
    85
hg log -r '"x  y"'
7261
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    86
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    87
echo % reject bookmark name with newline
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    88
hg bookmark '
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    89
'
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    90
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    91
echo % bookmark with existing name
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    92
hg bookmark Z
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    93
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    94
echo % force bookmark with existing name
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    95
hg bookmark -f Z
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    96
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    97
echo % list bookmarks
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    98
hg bookmark
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
    99
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   100
echo % revision but no bookmark name
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   101
hg bookmark -r .
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   102
4ba89b6d0e05 bookmarks: Add tests
Joel Rosdahl <joel@rosdahl.net>
parents:
diff changeset
   103
true