tests/test-bookmarks.t
changeset 11861 41d481ddd976
parent 11704 18c47562d331
child 12316 4134686b83e1
equal deleted inserted replaced
11860:56c7c3209e1a 11861:41d481ddd976
       
     1   $ echo "[extensions]" >> $HGRCPATH
       
     2   $ echo "bookmarks=" >> $HGRCPATH
       
     3 
       
     4   $ hg init
       
     5 
       
     6 no bookmarks
       
     7 
       
     8   $ hg bookmarks
       
     9   no bookmarks set
       
    10 
       
    11 bookmark rev -1
       
    12 
       
    13   $ hg bookmark X
       
    14 
       
    15 list bookmarks
       
    16 
       
    17   $ hg bookmarks
       
    18    * X                         -1:000000000000
       
    19 
       
    20 list bookmarks with color
       
    21 
       
    22   $ hg --config extensions.color= --config color.mode=ansi \
       
    23   >    bookmarks --color=always
       
    24    * X                         -1:000000000000
       
    25 
       
    26   $ echo a > a
       
    27   $ hg add a
       
    28   $ hg commit -m 0
       
    29 
       
    30 bookmark X moved to rev 0
       
    31 
       
    32   $ hg bookmarks
       
    33    * X                         0:f7b1eb17ad24
       
    34 
       
    35 look up bookmark
       
    36 
       
    37   $ hg log -r X
       
    38   changeset:   0:f7b1eb17ad24
       
    39   tag:         X
       
    40   tag:         tip
       
    41   user:        test
       
    42   date:        Thu Jan 01 00:00:00 1970 +0000
       
    43   summary:     0
       
    44   
       
    45 
       
    46 second bookmark for rev 0
       
    47 
       
    48   $ hg bookmark X2
       
    49 
       
    50 bookmark rev -1 again
       
    51 
       
    52   $ hg bookmark -r null Y
       
    53 
       
    54 list bookmarks
       
    55 
       
    56   $ hg bookmarks
       
    57    * X2                        0:f7b1eb17ad24
       
    58    * X                         0:f7b1eb17ad24
       
    59      Y                         -1:000000000000
       
    60 
       
    61   $ echo b > b
       
    62   $ hg add b
       
    63   $ hg commit -m 1
       
    64 
       
    65 bookmarks X and X2 moved to rev 1, Y at rev -1
       
    66 
       
    67   $ hg bookmarks
       
    68    * X2                        1:925d80f479bb
       
    69    * X                         1:925d80f479bb
       
    70      Y                         -1:000000000000
       
    71 
       
    72 bookmark rev 0 again
       
    73 
       
    74   $ hg bookmark -r 0 Z
       
    75 
       
    76   $ echo c > c
       
    77   $ hg add c
       
    78   $ hg commit -m 2
       
    79 
       
    80 bookmarks X and X2 moved to rev 2, Y at rev -1, Z at rev 0
       
    81 
       
    82   $ hg bookmarks
       
    83    * X2                        2:0316ce92851d
       
    84    * X                         2:0316ce92851d
       
    85      Z                         0:f7b1eb17ad24
       
    86      Y                         -1:000000000000
       
    87 
       
    88 rename nonexistent bookmark
       
    89 
       
    90   $ hg bookmark -m A B
       
    91   abort: a bookmark of this name does not exist
       
    92 
       
    93 rename to existent bookmark
       
    94 
       
    95   $ hg bookmark -m X Y
       
    96   abort: a bookmark of the same name already exists
       
    97 
       
    98 force rename to existent bookmark
       
    99 
       
   100   $ hg bookmark -f -m X Y
       
   101 
       
   102 list bookmarks
       
   103 
       
   104   $ hg bookmark
       
   105    * X2                        2:0316ce92851d
       
   106    * Y                         2:0316ce92851d
       
   107      Z                         0:f7b1eb17ad24
       
   108 
       
   109 rename without new name
       
   110 
       
   111   $ hg bookmark -m Y
       
   112   abort: new bookmark name required
       
   113 
       
   114 delete without name
       
   115 
       
   116   $ hg bookmark -d
       
   117   abort: bookmark name required
       
   118 
       
   119 delete nonexistent bookmark
       
   120 
       
   121   $ hg bookmark -d A
       
   122   abort: a bookmark of this name does not exist
       
   123 
       
   124 bookmark name with spaces should be stripped
       
   125 
       
   126   $ hg bookmark ' x  y '
       
   127 
       
   128 list bookmarks
       
   129 
       
   130   $ hg bookmarks
       
   131    * X2                        2:0316ce92851d
       
   132    * Y                         2:0316ce92851d
       
   133      Z                         0:f7b1eb17ad24
       
   134    * x  y                      2:0316ce92851d
       
   135 
       
   136 look up stripped bookmark name
       
   137 
       
   138   $ hg log -r '"x  y"'
       
   139   changeset:   2:0316ce92851d
       
   140   tag:         X2
       
   141   tag:         Y
       
   142   tag:         tip
       
   143   tag:         x  y
       
   144   user:        test
       
   145   date:        Thu Jan 01 00:00:00 1970 +0000
       
   146   summary:     2
       
   147   
       
   148 
       
   149 reject bookmark name with newline
       
   150 
       
   151   $ hg bookmark '
       
   152   > '
       
   153   abort: bookmark name cannot contain newlines
       
   154 
       
   155 bookmark with existing name
       
   156 
       
   157   $ hg bookmark Z
       
   158   abort: a bookmark of the same name already exists
       
   159 
       
   160 force bookmark with existing name
       
   161 
       
   162   $ hg bookmark -f Z
       
   163 
       
   164 list bookmarks
       
   165 
       
   166   $ hg bookmark
       
   167    * X2                        2:0316ce92851d
       
   168    * Y                         2:0316ce92851d
       
   169    * Z                         2:0316ce92851d
       
   170    * x  y                      2:0316ce92851d
       
   171 
       
   172 revision but no bookmark name
       
   173 
       
   174   $ hg bookmark -r .
       
   175   abort: bookmark name required
       
   176 
       
   177 bookmark name with whitespace only
       
   178 
       
   179   $ hg bookmark ' '
       
   180   abort: bookmark names cannot consist entirely of whitespace
       
   181 
       
   182   $ true