| 1 |
$ cat >> $HGRCPATH <<EOF |
| 2 |
> [experimental] |
| 3 |
> bundle-phases=yes |
| 4 |
> [extensions] |
| 5 |
> strip= |
| 6 |
> drawdag=$TESTDIR/drawdag.py |
| 7 |
> EOF |
| 8 |
|
| 9 |
Set up repo with linear history |
| 10 |
$ hg init linear |
| 11 |
$ cd linear |
| 12 |
$ hg debugdrawdag <<'EOF' |
| 13 |
> E |
| 14 |
> | |
| 15 |
> D |
| 16 |
> | |
| 17 |
> C |
| 18 |
> | |
| 19 |
> B |
| 20 |
> | |
| 21 |
> A |
| 22 |
> EOF |
| 23 |
$ hg phase --public A |
| 24 |
$ hg phase --force --secret D |
| 25 |
$ hg log -G -T '{desc} {phase}\n' |
| 26 |
o E secret |
| 27 |
| |
| 28 |
o D secret |
| 29 |
| |
| 30 |
o C draft |
| 31 |
| |
| 32 |
o B draft |
| 33 |
| |
| 34 |
o A public |
| 35 |
|
| 36 |
$ hg bundle --base B -r E bundle |
| 37 |
3 changesets found |
| 38 |
$ hg debugbundle bundle |
| 39 |
Stream params: {Compression: BZ} |
| 40 |
changegroup -- {nbchanges: 3, targetphase: 2, version: 02} (mandatory: True) |
| 41 |
26805aba1e600a82e93661149f2313866a221a7b |
| 42 |
f585351a92f85104bff7c284233c338b10eb1df7 |
| 43 |
9bc730a19041f9ec7cb33c626e811aa233efb18c |
| 44 |
cache:rev-branch-cache -- {} (mandatory: False) |
| 45 |
phase-heads -- {} (mandatory: True) |
| 46 |
26805aba1e600a82e93661149f2313866a221a7b draft |
| 47 |
9bc730a19041f9ec7cb33c626e811aa233efb18c secret |
| 48 |
$ hg strip --no-backup C |
| 49 |
|
| 50 |
Phases show on incoming, and are also restored when pulling. Secret commits |
| 51 |
aren't incoming or pulled, following usual incoming/pull semantics. |
| 52 |
|
| 53 |
$ hg log -R bundle -r 'bundle()^+bundle()' -G -T '{desc} {phase}\n' |
| 54 |
o E secret |
| 55 |
| |
| 56 |
o D secret |
| 57 |
| |
| 58 |
o C draft |
| 59 |
| |
| 60 |
o B draft |
| 61 |
| |
| 62 |
~ |
| 63 |
|
| 64 |
$ hg incoming bundle -G -T '{desc} {phase}\n' |
| 65 |
comparing with bundle |
| 66 |
searching for changes |
| 67 |
o C draft |
| 68 |
|
| 69 |
$ hg pull bundle |
| 70 |
pulling from bundle |
| 71 |
searching for changes |
| 72 |
adding changesets |
| 73 |
adding manifests |
| 74 |
adding file changes |
| 75 |
added 1 changesets with 1 changes to 1 files |
| 76 |
new changesets 26805aba1e60 (1 drafts) |
| 77 |
(run 'hg update' to get a working copy) |
| 78 |
$ hg log -G -T '{desc} {phase}\n' |
| 79 |
o C draft |
| 80 |
| |
| 81 |
o B draft |
| 82 |
| |
| 83 |
o A public |
| 84 |
|
| 85 |
$ hg log -R bundle -r 'bundle()^+bundle()' -G -T '{desc} {phase}\n' |
| 86 |
o E secret |
| 87 |
| |
| 88 |
o D secret |
| 89 |
| |
| 90 |
o C draft |
| 91 |
| |
| 92 |
o B draft |
| 93 |
| |
| 94 |
~ |
| 95 |
|
| 96 |
$ hg rollback --config ui.rollback=1 |
| 97 |
repository tip rolled back to revision 1 (undo pull) |
| 98 |
|
| 99 |
Phases are restored when unbundling |
| 100 |
$ hg unbundle -q bundle |
| 101 |
$ rm bundle |
| 102 |
$ hg log -G -T '{desc} {phase}\n' |
| 103 |
o E secret |
| 104 |
| |
| 105 |
o D secret |
| 106 |
| |
| 107 |
o C draft |
| 108 |
| |
| 109 |
o B draft |
| 110 |
| |
| 111 |
o A public |
| 112 |
|
| 113 |
Root revision's phase is preserved |
| 114 |
$ hg bundle -a bundle |
| 115 |
5 changesets found |
| 116 |
$ hg strip --no-backup A |
| 117 |
$ hg unbundle -q bundle |
| 118 |
$ hg log -G -T '{desc} {phase}\n' |
| 119 |
o E secret |
| 120 |
| |
| 121 |
o D secret |
| 122 |
| |
| 123 |
o C draft |
| 124 |
| |
| 125 |
o B draft |
| 126 |
| |
| 127 |
o A public |
| 128 |
|
| 129 |
$ hg init empty |
| 130 |
$ hg -R empty pull bundle |
| 131 |
pulling from bundle |
| 132 |
requesting all changes |
| 133 |
adding changesets |
| 134 |
adding manifests |
| 135 |
adding file changes |
| 136 |
added 3 changesets with 3 changes to 3 files |
| 137 |
new changesets 426bada5c675:26805aba1e60 (2 drafts) |
| 138 |
(run 'hg update' to get a working copy) |
| 139 |
$ hg log -G -T '{desc} {phase}\n' |
| 140 |
o E secret |
| 141 |
| |
| 142 |
o D secret |
| 143 |
| |
| 144 |
o C draft |
| 145 |
| |
| 146 |
o B draft |
| 147 |
| |
| 148 |
o A public |
| 149 |
|
| 150 |
|
| 151 |
Public repo commits take precedence over phases in the bundle |
| 152 |
$ hg phase --public E |
| 153 |
$ hg incoming bundle -G -T '{desc} {phase}\n' |
| 154 |
comparing with bundle |
| 155 |
searching for changes |
| 156 |
no changes found |
| 157 |
$ hg log -R bundle -r 'bundle()^+bundle()' -G -T '{desc} {phase}\n' |
| 158 |
o E public |
| 159 |
| |
| 160 |
o D public |
| 161 |
| |
| 162 |
o C public |
| 163 |
| |
| 164 |
o B public |
| 165 |
| |
| 166 |
o A public |
| 167 |
|
| 168 |
$ hg pull bundle |
| 169 |
pulling from bundle |
| 170 |
searching for changes |
| 171 |
no changes found |
| 172 |
$ hg log -G -T '{desc} {phase}\n' |
| 173 |
o E public |
| 174 |
| |
| 175 |
o D public |
| 176 |
| |
| 177 |
o C public |
| 178 |
| |
| 179 |
o B public |
| 180 |
| |
| 181 |
o A public |
| 182 |
|
| 183 |
$ rm bundle |
| 184 |
|
| 185 |
A bundle with public phases that are not public in the repo will show as public |
| 186 |
with `hg log`, but will remain not public in the plain repo. |
| 187 |
|
| 188 |
$ hg bundle --base B -r E bundle |
| 189 |
3 changesets found |
| 190 |
$ hg phase --force --draft -r C |
| 191 |
|
| 192 |
$ hg log -R bundle -G -T '{desc} {phase}\n' |
| 193 |
o E public |
| 194 |
| |
| 195 |
o D public |
| 196 |
| |
| 197 |
o C public |
| 198 |
| |
| 199 |
o B public |
| 200 |
| |
| 201 |
o A public |
| 202 |
|
| 203 |
$ hg log -G -T '{desc} {phase}\n' |
| 204 |
o E draft |
| 205 |
| |
| 206 |
o D draft |
| 207 |
| |
| 208 |
o C draft |
| 209 |
| |
| 210 |
o B public |
| 211 |
| |
| 212 |
o A public |
| 213 |
|
| 214 |
$ hg phase --public -r E |
| 215 |
$ rm bundle |
| 216 |
|
| 217 |
Completely public history can be restored |
| 218 |
$ hg bundle -a bundle |
| 219 |
5 changesets found |
| 220 |
$ hg strip --no-backup A |
| 221 |
$ hg unbundle -q bundle |
| 222 |
$ rm bundle |
| 223 |
$ hg log -G -T '{desc} {phase}\n' |
| 224 |
o E public |
| 225 |
| |
| 226 |
o D public |
| 227 |
| |
| 228 |
o C public |
| 229 |
| |
| 230 |
o B public |
| 231 |
| |
| 232 |
o A public |
| 233 |
|
| 234 |
Direct transition from public to secret can be restored |
| 235 |
$ hg phase --secret --force D |
| 236 |
$ hg bundle -a bundle |
| 237 |
5 changesets found |
| 238 |
$ hg strip --no-backup A |
| 239 |
$ hg unbundle -q bundle |
| 240 |
$ rm bundle |
| 241 |
$ hg log -G -T '{desc} {phase}\n' |
| 242 |
o E secret |
| 243 |
| |
| 244 |
o D secret |
| 245 |
| |
| 246 |
o C public |
| 247 |
| |
| 248 |
o B public |
| 249 |
| |
| 250 |
o A public |
| 251 |
|
| 252 |
Revisions within bundle preserve their phase even if parent changes its phase |
| 253 |
$ hg phase --draft --force B |
| 254 |
$ hg bundle --base B -r E bundle |
| 255 |
3 changesets found |
| 256 |
$ hg strip --no-backup C |
| 257 |
$ hg phase --public B |
| 258 |
$ hg unbundle -q bundle |
| 259 |
$ rm bundle |
| 260 |
$ hg log -G -T '{desc} {phase}\n' |
| 261 |
o E secret |
| 262 |
| |
| 263 |
o D secret |
| 264 |
| |
| 265 |
o C draft |
| 266 |
| |
| 267 |
o B public |
| 268 |
| |
| 269 |
o A public |
| 270 |
|
| 271 |
Phase of ancestors of stripped node get advanced to accommodate child |
| 272 |
$ hg bundle --base B -r E bundle |
| 273 |
3 changesets found |
| 274 |
$ hg strip --no-backup C |
| 275 |
$ hg phase --force --secret B |
| 276 |
$ hg unbundle -q bundle |
| 277 |
$ rm bundle |
| 278 |
$ hg log -G -T '{desc} {phase}\n' |
| 279 |
o E secret |
| 280 |
| |
| 281 |
o D secret |
| 282 |
| |
| 283 |
o C draft |
| 284 |
| |
| 285 |
o B draft |
| 286 |
| |
| 287 |
o A public |
| 288 |
|
| 289 |
Unbundling advances phases of changesets even if they were already in the repo. |
| 290 |
To test that, create a bundle of everything in draft phase and then unbundle |
| 291 |
to see that secret becomes draft, but public remains public. |
| 292 |
$ hg phase --draft --force A |
| 293 |
$ hg phase --draft E |
| 294 |
$ hg bundle -a bundle |
| 295 |
5 changesets found |
| 296 |
$ hg phase --public A |
| 297 |
$ hg phase --secret --force E |
| 298 |
$ hg unbundle -q bundle |
| 299 |
$ rm bundle |
| 300 |
$ hg log -G -T '{desc} {phase}\n' |
| 301 |
o E draft |
| 302 |
| |
| 303 |
o D draft |
| 304 |
| |
| 305 |
o C draft |
| 306 |
| |
| 307 |
o B draft |
| 308 |
| |
| 309 |
o A public |
| 310 |
|
| 311 |
Unbundling change in the middle of a stack does not affect later changes |
| 312 |
$ hg strip --no-backup E |
| 313 |
$ hg phase --secret --force D |
| 314 |
$ hg log -G -T '{desc} {phase}\n' |
| 315 |
o D secret |
| 316 |
| |
| 317 |
o C draft |
| 318 |
| |
| 319 |
o B draft |
| 320 |
| |
| 321 |
o A public |
| 322 |
|
| 323 |
$ hg bundle --base A -r B bundle |
| 324 |
1 changesets found |
| 325 |
$ hg unbundle -q bundle |
| 326 |
$ rm bundle |
| 327 |
$ hg log -G -T '{desc} {phase}\n' |
| 328 |
o D secret |
| 329 |
| |
| 330 |
o C draft |
| 331 |
| |
| 332 |
o B draft |
| 333 |
| |
| 334 |
o A public |
| 335 |
|
| 336 |
|
| 337 |
$ cd .. |
| 338 |
|
| 339 |
Set up repo with non-linear history |
| 340 |
$ hg init non-linear |
| 341 |
$ cd non-linear |
| 342 |
$ hg debugdrawdag <<'EOF' |
| 343 |
> D E |
| 344 |
> |\| |
| 345 |
> B C |
| 346 |
> |/ |
| 347 |
> A |
| 348 |
> EOF |
| 349 |
$ hg phase --public C |
| 350 |
$ hg phase --force --secret B |
| 351 |
$ hg log -G -T '{node|short} {desc} {phase}\n' |
| 352 |
o 03ca77807e91 E draft |
| 353 |
| |
| 354 |
| o 4e4f9194f9f1 D secret |
| 355 |
|/| |
| 356 |
o | dc0947a82db8 C public |
| 357 |
| | |
| 358 |
| o 112478962961 B secret |
| 359 |
|/ |
| 360 |
o 426bada5c675 A public |
| 361 |
|
| 362 |
|
| 363 |
Restore bundle of entire repo |
| 364 |
$ hg bundle -a bundle |
| 365 |
5 changesets found |
| 366 |
$ hg debugbundle bundle |
| 367 |
Stream params: {Compression: BZ} |
| 368 |
changegroup -- {nbchanges: 5, targetphase: 2, version: 02} (mandatory: True) |
| 369 |
426bada5c67598ca65036d57d9e4b64b0c1ce7a0 |
| 370 |
112478962961147124edd43549aedd1a335e44bf |
| 371 |
dc0947a82db884575bb76ea10ac97b08536bfa03 |
| 372 |
4e4f9194f9f181c57f62e823e8bdfa46ab9e4ff4 |
| 373 |
03ca77807e919db8807c3749086dc36fb478cac0 |
| 374 |
cache:rev-branch-cache -- {} (mandatory: False) |
| 375 |
phase-heads -- {} (mandatory: True) |
| 376 |
dc0947a82db884575bb76ea10ac97b08536bfa03 public |
| 377 |
03ca77807e919db8807c3749086dc36fb478cac0 draft |
| 378 |
4e4f9194f9f181c57f62e823e8bdfa46ab9e4ff4 secret |
| 379 |
$ hg strip --no-backup A |
| 380 |
$ hg unbundle -q bundle |
| 381 |
$ rm bundle |
| 382 |
$ hg log -G -T '{node|short} {desc} {phase}\n' |
| 383 |
o 03ca77807e91 E draft |
| 384 |
| |
| 385 |
| o 4e4f9194f9f1 D secret |
| 386 |
|/| |
| 387 |
o | dc0947a82db8 C public |
| 388 |
| | |
| 389 |
| o 112478962961 B secret |
| 390 |
|/ |
| 391 |
o 426bada5c675 A public |
| 392 |
|
| 393 |
|
| 394 |
$ hg bundle --base 'A + C' -r D bundle |
| 395 |
2 changesets found |
| 396 |
$ hg debugbundle bundle |
| 397 |
Stream params: {Compression: BZ} |
| 398 |
changegroup -- {nbchanges: 2, targetphase: 2, version: 02} (mandatory: True) |
| 399 |
112478962961147124edd43549aedd1a335e44bf |
| 400 |
4e4f9194f9f181c57f62e823e8bdfa46ab9e4ff4 |
| 401 |
cache:rev-branch-cache -- {} (mandatory: False) |
| 402 |
phase-heads -- {} (mandatory: True) |
| 403 |
4e4f9194f9f181c57f62e823e8bdfa46ab9e4ff4 secret |
| 404 |
$ rm bundle |
| 405 |
|
| 406 |
$ hg bundle --base A -r D bundle |
| 407 |
3 changesets found |
| 408 |
$ hg debugbundle bundle |
| 409 |
Stream params: {Compression: BZ} |
| 410 |
changegroup -- {nbchanges: 3, targetphase: 2, version: 02} (mandatory: True) |
| 411 |
112478962961147124edd43549aedd1a335e44bf |
| 412 |
dc0947a82db884575bb76ea10ac97b08536bfa03 |
| 413 |
4e4f9194f9f181c57f62e823e8bdfa46ab9e4ff4 |
| 414 |
cache:rev-branch-cache -- {} (mandatory: False) |
| 415 |
phase-heads -- {} (mandatory: True) |
| 416 |
dc0947a82db884575bb76ea10ac97b08536bfa03 public |
| 417 |
4e4f9194f9f181c57f62e823e8bdfa46ab9e4ff4 secret |
| 418 |
$ rm bundle |
| 419 |
|
| 420 |
$ hg bundle --base 'B + C' -r 'D + E' bundle |
| 421 |
2 changesets found |
| 422 |
$ hg debugbundle bundle |
| 423 |
Stream params: {Compression: BZ} |
| 424 |
changegroup -- {nbchanges: 2, targetphase: 2, version: 02} (mandatory: True) |
| 425 |
4e4f9194f9f181c57f62e823e8bdfa46ab9e4ff4 |
| 426 |
03ca77807e919db8807c3749086dc36fb478cac0 |
| 427 |
cache:rev-branch-cache -- {} (mandatory: False) |
| 428 |
phase-heads -- {} (mandatory: True) |
| 429 |
03ca77807e919db8807c3749086dc36fb478cac0 draft |
| 430 |
4e4f9194f9f181c57f62e823e8bdfa46ab9e4ff4 secret |
| 431 |
$ rm bundle |