| 1 |
$ hg init repo |
| 2 |
$ cd repo |
| 3 |
|
| 4 |
no bookmarks |
| 5 |
|
| 6 |
$ hg bookmarks |
| 7 |
no bookmarks set |
| 8 |
|
| 9 |
set bookmark X |
| 10 |
|
| 11 |
$ hg bookmark X |
| 12 |
|
| 13 |
list bookmarks |
| 14 |
|
| 15 |
$ hg bookmark |
| 16 |
* X -1:000000000000 |
| 17 |
|
| 18 |
list bookmarks with color |
| 19 |
|
| 20 |
$ hg --config extensions.color= --config color.mode=ansi \ |
| 21 |
> bookmark --color=always |
| 22 |
\x1b[0;32m * \x1b[0m\x1b[0;32mX\x1b[0m\x1b[0;32m -1:000000000000\x1b[0m (esc) |
| 23 |
|
| 24 |
update to bookmark X |
| 25 |
|
| 26 |
$ hg bookmarks |
| 27 |
* X -1:000000000000 |
| 28 |
$ hg update X |
| 29 |
0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 30 |
|
| 31 |
list bookmarks |
| 32 |
|
| 33 |
$ hg bookmarks |
| 34 |
* X -1:000000000000 |
| 35 |
|
| 36 |
rename |
| 37 |
|
| 38 |
$ hg bookmark -m X Z |
| 39 |
|
| 40 |
list bookmarks |
| 41 |
|
| 42 |
$ cat .hg/bookmarks.current |
| 43 |
Z (no-eol) |
| 44 |
$ cat .hg/bookmarks |
| 45 |
0000000000000000000000000000000000000000 Z |
| 46 |
$ hg bookmarks |
| 47 |
* Z -1:000000000000 |
| 48 |
|
| 49 |
new bookmarks X and Y, first one made active |
| 50 |
|
| 51 |
$ hg bookmark Y X |
| 52 |
|
| 53 |
list bookmarks |
| 54 |
|
| 55 |
$ hg bookmark |
| 56 |
X -1:000000000000 |
| 57 |
* Y -1:000000000000 |
| 58 |
Z -1:000000000000 |
| 59 |
|
| 60 |
$ hg bookmark -d X |
| 61 |
|
| 62 |
commit |
| 63 |
|
| 64 |
$ echo 'b' > b |
| 65 |
$ hg add b |
| 66 |
$ hg commit -m'test' |
| 67 |
|
| 68 |
list bookmarks |
| 69 |
|
| 70 |
$ hg bookmark |
| 71 |
* Y 0:719295282060 |
| 72 |
Z -1:000000000000 |
| 73 |
|
| 74 |
Verify that switching to Z updates the active bookmark: |
| 75 |
$ hg update Z |
| 76 |
0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 77 |
(activating bookmark Z) |
| 78 |
$ hg bookmark |
| 79 |
Y 0:719295282060 |
| 80 |
* Z -1:000000000000 |
| 81 |
|
| 82 |
Switch back to Y for the remaining tests in this file: |
| 83 |
$ hg update Y |
| 84 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 85 |
(activating bookmark Y) |
| 86 |
|
| 87 |
delete bookmarks |
| 88 |
|
| 89 |
$ hg bookmark -d Y |
| 90 |
$ hg bookmark -d Z |
| 91 |
|
| 92 |
list bookmarks |
| 93 |
|
| 94 |
$ hg bookmark |
| 95 |
no bookmarks set |
| 96 |
|
| 97 |
update to tip |
| 98 |
|
| 99 |
$ hg update tip |
| 100 |
0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 101 |
|
| 102 |
set bookmark Y using -r . but make sure that the active |
| 103 |
bookmark is not activated |
| 104 |
|
| 105 |
$ hg bookmark -r . Y |
| 106 |
|
| 107 |
list bookmarks, Y should not be active |
| 108 |
|
| 109 |
$ hg bookmark |
| 110 |
Y 0:719295282060 |
| 111 |
|
| 112 |
now, activate Y |
| 113 |
|
| 114 |
$ hg up -q Y |
| 115 |
|
| 116 |
set bookmark Z using -i |
| 117 |
|
| 118 |
$ hg bookmark -r . -i Z |
| 119 |
$ hg bookmarks |
| 120 |
* Y 0:719295282060 |
| 121 |
Z 0:719295282060 |
| 122 |
|
| 123 |
deactivate active bookmark using -i |
| 124 |
|
| 125 |
$ hg bookmark -i Y |
| 126 |
$ hg bookmarks |
| 127 |
Y 0:719295282060 |
| 128 |
Z 0:719295282060 |
| 129 |
|
| 130 |
$ hg up -q Y |
| 131 |
$ hg bookmark -i |
| 132 |
$ hg bookmarks |
| 133 |
Y 0:719295282060 |
| 134 |
Z 0:719295282060 |
| 135 |
$ hg bookmark -i |
| 136 |
no active bookmark |
| 137 |
$ hg up -q Y |
| 138 |
$ hg bookmarks |
| 139 |
* Y 0:719295282060 |
| 140 |
Z 0:719295282060 |
| 141 |
|
| 142 |
deactivate active bookmark while renaming |
| 143 |
|
| 144 |
$ hg bookmark -i -m Y X |
| 145 |
$ hg bookmarks |
| 146 |
X 0:719295282060 |
| 147 |
Z 0:719295282060 |
| 148 |
|
| 149 |
bare update moves the active bookmark forward and clear the divergent bookmarks |
| 150 |
|
| 151 |
$ echo a > a |
| 152 |
$ hg ci -Am1 |
| 153 |
adding a |
| 154 |
$ echo b >> a |
| 155 |
$ hg ci -Am2 |
| 156 |
$ hg bookmark X@1 -r 1 |
| 157 |
$ hg bookmark X@2 -r 2 |
| 158 |
$ hg update X |
| 159 |
0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 160 |
(activating bookmark X) |
| 161 |
$ hg bookmarks |
| 162 |
* X 0:719295282060 |
| 163 |
X@1 1:cc586d725fbe |
| 164 |
X@2 2:49e1c4e84c58 |
| 165 |
Z 0:719295282060 |
| 166 |
$ hg update |
| 167 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 168 |
updating bookmark X |
| 169 |
$ hg bookmarks |
| 170 |
* X 2:49e1c4e84c58 |
| 171 |
Z 0:719295282060 |
| 172 |
|
| 173 |
test deleting .hg/bookmarks.current when explicitly updating |
| 174 |
to a revision |
| 175 |
|
| 176 |
$ echo a >> b |
| 177 |
$ hg ci -m. |
| 178 |
$ hg up -q X |
| 179 |
$ test -f .hg/bookmarks.current |
| 180 |
|
| 181 |
try to update to it again to make sure we don't |
| 182 |
set and then unset it |
| 183 |
|
| 184 |
$ hg up -q X |
| 185 |
$ test -f .hg/bookmarks.current |
| 186 |
|
| 187 |
$ hg up -q 1 |
| 188 |
$ test -f .hg/bookmarks.current |
| 189 |
[1] |
| 190 |
|
| 191 |
when a bookmark is active, hg up -r . is |
| 192 |
analogous to hg book -i <active bookmark> |
| 193 |
|
| 194 |
$ hg up -q X |
| 195 |
$ hg up -q . |
| 196 |
$ test -f .hg/bookmarks.current |
| 197 |
[1] |
| 198 |
|
| 199 |
issue 4552 -- simulate a pull moving the active bookmark |
| 200 |
|
| 201 |
$ hg up -q X |
| 202 |
$ printf "Z" > .hg/bookmarks.current |
| 203 |
$ hg log -T '{activebookmark}\n' -r Z |
| 204 |
Z |
| 205 |
$ hg log -T '{bookmarks % "{active}\n"}' -r Z |
| 206 |
Z |
| 207 |
|
| 208 |
test that updating to closed branch head also advances active bookmark |
| 209 |
|
| 210 |
$ hg commit --close-branch -m "closed" |
| 211 |
$ hg update -q ".^1" |
| 212 |
$ hg bookmark Y |
| 213 |
$ hg bookmarks |
| 214 |
X 3:4d6bd4bfb1ae |
| 215 |
* Y 3:4d6bd4bfb1ae |
| 216 |
Z 0:719295282060 |
| 217 |
$ hg update |
| 218 |
0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 219 |
updating bookmark Y |
| 220 |
$ hg bookmarks |
| 221 |
X 3:4d6bd4bfb1ae |
| 222 |
* Y 4:8fa964221e8e |
| 223 |
Z 0:719295282060 |
| 224 |
$ hg parents -q |
| 225 |
4:8fa964221e8e |
| 226 |
|
| 227 |
Checks command to retrieve active bookmark |
| 228 |
------------------------------------------ |
| 229 |
|
| 230 |
display how "{activebookmark}" template is unsuitable for the task |
| 231 |
|
| 232 |
$ hg book -T '- {activebookmark}\n' |
| 233 |
- |
| 234 |
- Y |
| 235 |
- |
| 236 |
|
| 237 |
$ hg book -r . W |
| 238 |
$ hg book -T '- {activebookmark}\n' |
| 239 |
- Y |
| 240 |
- |
| 241 |
- Y |
| 242 |
- |
| 243 |
|
| 244 |
$ hg bookmarks -ql . |
| 245 |
Y |
| 246 |
$ hg bookmarks --inactive |
| 247 |
$ hg bookmarks -ql . |
| 248 |
abort: no active bookmark |
| 249 |
[10] |