| 1 |
#testcases stripbased phasebased |
| 2 |
#testcases dirstate-v1 dirstate-v2 |
| 3 |
|
| 4 |
#if dirstate-v2 |
| 5 |
$ cat >> $HGRCPATH << EOF |
| 6 |
> [format] |
| 7 |
> use-dirstate-v2=1 |
| 8 |
> [storage] |
| 9 |
> dirstate-v2.slow-path=allow |
| 10 |
> EOF |
| 11 |
#endif |
| 12 |
|
| 13 |
$ cat <<EOF >> $HGRCPATH |
| 14 |
> [extensions] |
| 15 |
> mq = |
| 16 |
> [defaults] |
| 17 |
> diff = --nodates --git |
| 18 |
> qnew = --date '0 0' |
| 19 |
> [shelve] |
| 20 |
> maxbackups = 2 |
| 21 |
> EOF |
| 22 |
|
| 23 |
#if phasebased |
| 24 |
|
| 25 |
$ cat <<EOF >> $HGRCPATH |
| 26 |
> [format] |
| 27 |
> use-internal-phase = yes |
| 28 |
> EOF |
| 29 |
|
| 30 |
#endif |
| 31 |
|
| 32 |
$ hg init repo |
| 33 |
$ cd repo |
| 34 |
$ mkdir a b |
| 35 |
$ echo a > a/a |
| 36 |
$ echo b > b/b |
| 37 |
$ echo c > c |
| 38 |
$ echo d > d |
| 39 |
$ echo x > x |
| 40 |
$ hg addremove -q |
| 41 |
|
| 42 |
shelve has a help message |
| 43 |
$ hg shelve -h |
| 44 |
hg shelve [OPTION]... [FILE]... |
| 45 |
|
| 46 |
save and set aside changes from the working directory |
| 47 |
|
| 48 |
Shelving takes files that "hg status" reports as not clean, saves the |
| 49 |
modifications to a bundle (a shelved change), and reverts the files so that |
| 50 |
their state in the working directory becomes clean. |
| 51 |
|
| 52 |
To restore these changes to the working directory, using "hg unshelve"; this |
| 53 |
will work even if you switch to a different commit. |
| 54 |
|
| 55 |
When no files are specified, "hg shelve" saves all not-clean files. If |
| 56 |
specific files or directories are named, only changes to those files are |
| 57 |
shelved. |
| 58 |
|
| 59 |
In bare shelve (when no files are specified, without interactive, include and |
| 60 |
exclude option), shelving remembers information if the working directory was |
| 61 |
on newly created branch, in other words working directory was on different |
| 62 |
branch than its first parent. In this situation unshelving restores branch |
| 63 |
information to the working directory. |
| 64 |
|
| 65 |
Each shelved change has a name that makes it easier to find later. The name of |
| 66 |
a shelved change defaults to being based on the active bookmark, or if there |
| 67 |
is no active bookmark, the current named branch. To specify a different name, |
| 68 |
use "--name". |
| 69 |
|
| 70 |
To see a list of existing shelved changes, use the "--list" option. For each |
| 71 |
shelved change, this will print its name, age, and description; use "--patch" |
| 72 |
or "--stat" for more details. |
| 73 |
|
| 74 |
To delete specific shelved changes, use "--delete". To delete all shelved |
| 75 |
changes, use "--cleanup". |
| 76 |
|
| 77 |
options ([+] can be repeated): |
| 78 |
|
| 79 |
-A --addremove mark new/missing files as added/removed before |
| 80 |
shelving |
| 81 |
-u --unknown store unknown files in the shelve |
| 82 |
--cleanup delete all shelved changes |
| 83 |
--date DATE shelve with the specified commit date |
| 84 |
-d --delete delete the named shelved change(s) |
| 85 |
-e --edit invoke editor on commit messages |
| 86 |
-k --keep shelve, but keep changes in the working directory |
| 87 |
-l --list list current shelves |
| 88 |
-m --message TEXT use text as shelve message |
| 89 |
-n --name NAME use the given name for the shelved commit |
| 90 |
-p --patch output patches for changes (provide the names of the |
| 91 |
shelved changes as positional arguments) |
| 92 |
-i --interactive interactive mode |
| 93 |
--stat output diffstat-style summary of changes (provide |
| 94 |
the names of the shelved changes as positional |
| 95 |
arguments) |
| 96 |
-I --include PATTERN [+] include names matching the given patterns |
| 97 |
-X --exclude PATTERN [+] exclude names matching the given patterns |
| 98 |
--mq operate on patch repository |
| 99 |
|
| 100 |
(some details hidden, use --verbose to show complete help) |
| 101 |
|
| 102 |
shelving in an empty repo should be possible |
| 103 |
(this tests also that editor is not invoked, if '--edit' is not |
| 104 |
specified) |
| 105 |
|
| 106 |
$ HGEDITOR=cat hg shelve |
| 107 |
shelved as default |
| 108 |
0 files updated, 0 files merged, 5 files removed, 0 files unresolved |
| 109 |
|
| 110 |
$ hg unshelve |
| 111 |
unshelving change 'default' |
| 112 |
|
| 113 |
$ hg commit -q -m 'initial commit' |
| 114 |
|
| 115 |
$ hg shelve |
| 116 |
nothing changed |
| 117 |
[1] |
| 118 |
|
| 119 |
make sure shelve files were backed up |
| 120 |
|
| 121 |
$ ls .hg/shelve-backup |
| 122 |
default.hg |
| 123 |
default.patch |
| 124 |
default.shelve |
| 125 |
|
| 126 |
checks to make sure we dont create a directory or |
| 127 |
hidden file while choosing a new shelve name |
| 128 |
|
| 129 |
when we are given a name |
| 130 |
|
| 131 |
$ hg shelve -n foo/bar |
| 132 |
abort: shelved change names can not contain slashes |
| 133 |
[255] |
| 134 |
$ hg shelve -n .baz |
| 135 |
abort: shelved change names can not start with '.' |
| 136 |
[255] |
| 137 |
$ hg shelve -n foo\\bar |
| 138 |
abort: shelved change names can not contain slashes |
| 139 |
[255] |
| 140 |
|
| 141 |
when shelve has to choose itself |
| 142 |
|
| 143 |
$ hg branch x/y -q |
| 144 |
$ hg commit -q -m "Branch commit 0" |
| 145 |
$ hg shelve |
| 146 |
nothing changed |
| 147 |
[1] |
| 148 |
$ hg branch .x -q |
| 149 |
$ hg commit -q -m "Branch commit 1" |
| 150 |
$ hg shelve |
| 151 |
nothing changed |
| 152 |
[1] |
| 153 |
$ hg branch x\\y -q |
| 154 |
$ hg commit -q -m "Branch commit 2" |
| 155 |
$ hg shelve |
| 156 |
nothing changed |
| 157 |
[1] |
| 158 |
|
| 159 |
cleaning the branches made for name checking tests |
| 160 |
|
| 161 |
$ hg up default -q |
| 162 |
$ hg strip e9177275307e+6a6d231f43d+882bae7c62c2 -q |
| 163 |
|
| 164 |
create an mq patch - shelving should work fine with a patch applied |
| 165 |
|
| 166 |
$ echo n > n |
| 167 |
$ hg add n |
| 168 |
$ hg commit n -m second |
| 169 |
$ hg qnew second.patch |
| 170 |
|
| 171 |
shelve a change that we will delete later |
| 172 |
|
| 173 |
$ echo a >> a/a |
| 174 |
$ hg shelve |
| 175 |
shelved as default |
| 176 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 177 |
|
| 178 |
set up some more complex changes to shelve |
| 179 |
|
| 180 |
$ echo a >> a/a |
| 181 |
$ hg mv b b.rename |
| 182 |
moving b/b to b.rename/b |
| 183 |
$ hg cp c c.copy |
| 184 |
$ hg mv d ghost |
| 185 |
$ rm ghost |
| 186 |
$ hg status -C |
| 187 |
M a/a |
| 188 |
A b.rename/b |
| 189 |
b/b |
| 190 |
A c.copy |
| 191 |
c |
| 192 |
R b/b |
| 193 |
R d |
| 194 |
! ghost |
| 195 |
d |
| 196 |
|
| 197 |
the common case - no options or filenames |
| 198 |
|
| 199 |
$ hg shelve |
| 200 |
shelved as default-01 |
| 201 |
3 files updated, 0 files merged, 2 files removed, 0 files unresolved |
| 202 |
$ hg status -C |
| 203 |
|
| 204 |
ensure that our shelved changes exist |
| 205 |
|
| 206 |
$ hg shelve -l |
| 207 |
default-01 (*)* changes to: [mq]: second.patch (glob) |
| 208 |
default (*)* changes to: [mq]: second.patch (glob) |
| 209 |
|
| 210 |
$ hg shelve -l -p default |
| 211 |
default (*)* changes to: [mq]: second.patch (glob) |
| 212 |
|
| 213 |
diff --git a/a/a b/a/a |
| 214 |
--- a/a/a |
| 215 |
+++ b/a/a |
| 216 |
@@ -1,1 +1,2 @@ |
| 217 |
a |
| 218 |
+a |
| 219 |
|
| 220 |
$ hg shelve --list --addremove |
| 221 |
abort: options '--list' and '--addremove' may not be used together |
| 222 |
[10] |
| 223 |
|
| 224 |
delete our older shelved change |
| 225 |
|
| 226 |
$ hg shelve -d default |
| 227 |
$ hg qfinish -a -q |
| 228 |
|
| 229 |
ensure shelve backups aren't overwritten |
| 230 |
|
| 231 |
$ ls .hg/shelve-backup/ |
| 232 |
default-1.hg |
| 233 |
default-1.patch |
| 234 |
default-1.shelve |
| 235 |
default.hg |
| 236 |
default.patch |
| 237 |
default.shelve |
| 238 |
|
| 239 |
local edits should not prevent a shelved change from applying |
| 240 |
|
| 241 |
$ printf "z\na\n" > a/a |
| 242 |
$ hg unshelve --keep |
| 243 |
unshelving change 'default-01' |
| 244 |
temporarily committing pending changes (restore with 'hg unshelve --abort') |
| 245 |
rebasing shelved changes |
| 246 |
merging a/a |
| 247 |
|
| 248 |
$ hg revert --all -q |
| 249 |
$ rm a/a.orig b.rename/b c.copy |
| 250 |
|
| 251 |
apply it and make sure our state is as expected |
| 252 |
|
| 253 |
(this also tests that same timestamp prevents backups from being |
| 254 |
removed, even though there are more than 'maxbackups' backups) |
| 255 |
|
| 256 |
$ f -t .hg/shelve-backup/default.shelve |
| 257 |
.hg/shelve-backup/default.shelve: file |
| 258 |
$ touch -t 200001010000 .hg/shelve-backup/default.shelve |
| 259 |
$ f -t .hg/shelve-backup/default-1.shelve |
| 260 |
.hg/shelve-backup/default-1.shelve: file |
| 261 |
$ touch -t 200001010000 .hg/shelve-backup/default-1.shelve |
| 262 |
|
| 263 |
$ hg unshelve |
| 264 |
unshelving change 'default-01' |
| 265 |
$ hg status -C |
| 266 |
M a/a |
| 267 |
A b.rename/b |
| 268 |
b/b |
| 269 |
A c.copy |
| 270 |
c |
| 271 |
R b/b |
| 272 |
R d |
| 273 |
$ hg shelve -l |
| 274 |
|
| 275 |
(both of default.hg and default-1.hg should be still kept, because it |
| 276 |
is difficult to decide actual order of them from same timestamp) |
| 277 |
|
| 278 |
$ ls .hg/shelve-backup/ |
| 279 |
default-01.hg |
| 280 |
default-01.patch |
| 281 |
default-01.shelve |
| 282 |
default-1.hg |
| 283 |
default-1.patch |
| 284 |
default-1.shelve |
| 285 |
default.hg |
| 286 |
default.patch |
| 287 |
default.shelve |
| 288 |
|
| 289 |
$ hg unshelve |
| 290 |
abort: no shelved changes to apply! |
| 291 |
[20] |
| 292 |
$ hg unshelve foo |
| 293 |
abort: shelved change 'foo' not found |
| 294 |
[10] |
| 295 |
|
| 296 |
named shelves, specific filenames, and "commit messages" should all work |
| 297 |
(this tests also that editor is invoked, if '--edit' is specified) |
| 298 |
|
| 299 |
$ hg status -C |
| 300 |
M a/a |
| 301 |
A b.rename/b |
| 302 |
b/b |
| 303 |
A c.copy |
| 304 |
c |
| 305 |
R b/b |
| 306 |
R d |
| 307 |
$ HGEDITOR=cat hg shelve -q -n wibble -m wat -e a |
| 308 |
wat |
| 309 |
|
| 310 |
|
| 311 |
HG: Enter commit message. Lines beginning with 'HG:' are removed. |
| 312 |
HG: Leave message empty to abort commit. |
| 313 |
HG: -- |
| 314 |
HG: user: shelve@localhost |
| 315 |
HG: branch 'default' |
| 316 |
HG: changed a/a |
| 317 |
|
| 318 |
expect "a" to no longer be present, but status otherwise unchanged |
| 319 |
|
| 320 |
$ hg status -C |
| 321 |
A b.rename/b |
| 322 |
b/b |
| 323 |
A c.copy |
| 324 |
c |
| 325 |
R b/b |
| 326 |
R d |
| 327 |
$ hg shelve -l --stat |
| 328 |
wibble +\([^)]+\) +wat (re) |
| 329 |
a/a | 1 + |
| 330 |
1 files changed, 1 insertions(+), 0 deletions(-) |
| 331 |
|
| 332 |
and now "a/a" should reappear |
| 333 |
|
| 334 |
$ cd a |
| 335 |
$ hg unshelve -q wibble |
| 336 |
$ cd .. |
| 337 |
$ hg status -C |
| 338 |
M a/a |
| 339 |
A b.rename/b |
| 340 |
b/b |
| 341 |
A c.copy |
| 342 |
c |
| 343 |
R b/b |
| 344 |
R d |
| 345 |
|
| 346 |
ensure old shelve backups are being deleted automatically |
| 347 |
|
| 348 |
$ ls .hg/shelve-backup/ |
| 349 |
default-01.hg |
| 350 |
default-01.patch |
| 351 |
default-01.shelve |
| 352 |
wibble.hg |
| 353 |
wibble.patch |
| 354 |
wibble.shelve |
| 355 |
|
| 356 |
cause unshelving to result in a merge with 'a' conflicting |
| 357 |
|
| 358 |
$ hg shelve -q |
| 359 |
$ echo c>>a/a |
| 360 |
$ hg commit -m second |
| 361 |
$ hg tip --template '{files}\n' |
| 362 |
a/a |
| 363 |
|
| 364 |
add an unrelated change that should be preserved |
| 365 |
|
| 366 |
$ mkdir foo |
| 367 |
$ echo foo > foo/foo |
| 368 |
$ hg add foo/foo |
| 369 |
|
| 370 |
force a conflicted merge to occur |
| 371 |
|
| 372 |
$ hg unshelve |
| 373 |
unshelving change 'default' |
| 374 |
temporarily committing pending changes (restore with 'hg unshelve --abort') |
| 375 |
rebasing shelved changes |
| 376 |
merging a/a |
| 377 |
warning: conflicts while merging a/a! (edit, then use 'hg resolve --mark') |
| 378 |
unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') |
| 379 |
[240] |
| 380 |
$ hg status -v |
| 381 |
M a/a |
| 382 |
M b.rename/b |
| 383 |
M c.copy |
| 384 |
R b/b |
| 385 |
R d |
| 386 |
? a/a.orig |
| 387 |
# The repository is in an unfinished *unshelve* state. |
| 388 |
|
| 389 |
# Unresolved merge conflicts: |
| 390 |
# |
| 391 |
# a/a |
| 392 |
# |
| 393 |
# To mark files as resolved: hg resolve --mark FILE |
| 394 |
|
| 395 |
# To continue: hg unshelve --continue |
| 396 |
# To abort: hg unshelve --abort |
| 397 |
|
| 398 |
|
| 399 |
ensure that we have a merge with unresolved conflicts |
| 400 |
|
| 401 |
#if phasebased |
| 402 |
$ hg heads -q --template '{rev}\n' |
| 403 |
8 |
| 404 |
5 |
| 405 |
$ hg parents -q --template '{rev}\n' |
| 406 |
8 |
| 407 |
5 |
| 408 |
#endif |
| 409 |
|
| 410 |
#if stripbased |
| 411 |
$ hg heads -q --template '{rev}\n' |
| 412 |
5 |
| 413 |
4 |
| 414 |
$ hg parents -q --template '{rev}\n' |
| 415 |
4 |
| 416 |
5 |
| 417 |
#endif |
| 418 |
|
| 419 |
$ hg status |
| 420 |
M a/a |
| 421 |
M b.rename/b |
| 422 |
M c.copy |
| 423 |
R b/b |
| 424 |
R d |
| 425 |
? a/a.orig |
| 426 |
$ hg diff |
| 427 |
diff --git a/a/a b/a/a |
| 428 |
--- a/a/a |
| 429 |
+++ b/a/a |
| 430 |
@@ -1,2 +1,6 @@ |
| 431 |
a |
| 432 |
+<<<<<<< working-copy: 2377350b6337 - shelve: pending changes temporary commit |
| 433 |
c |
| 434 |
+======= |
| 435 |
+a |
| 436 |
+>>>>>>> shelved change: 203c9f771d2b - shelve: changes to: [mq]: second.patch |
| 437 |
diff --git a/b/b b/b.rename/b |
| 438 |
rename from b/b |
| 439 |
rename to b.rename/b |
| 440 |
diff --git a/c b/c.copy |
| 441 |
copy from c |
| 442 |
copy to c.copy |
| 443 |
diff --git a/d b/d |
| 444 |
deleted file mode 100644 |
| 445 |
--- a/d |
| 446 |
+++ /dev/null |
| 447 |
@@ -1,1 +0,0 @@ |
| 448 |
-d |
| 449 |
$ hg resolve -l |
| 450 |
U a/a |
| 451 |
|
| 452 |
$ hg shelve |
| 453 |
abort: unshelve already in progress |
| 454 |
(use 'hg unshelve --continue' or 'hg unshelve --abort') |
| 455 |
[20] |
| 456 |
|
| 457 |
abort the unshelve and be happy |
| 458 |
|
| 459 |
$ hg status |
| 460 |
M a/a |
| 461 |
M b.rename/b |
| 462 |
M c.copy |
| 463 |
R b/b |
| 464 |
R d |
| 465 |
? a/a.orig |
| 466 |
$ hg unshelve -a |
| 467 |
unshelve of 'default' aborted |
| 468 |
$ hg heads -q |
| 469 |
[37]:2e69b451d1ea (re) |
| 470 |
$ hg parents |
| 471 |
changeset: [37]:2e69b451d1ea (re) |
| 472 |
tag: tip |
| 473 |
parent: 3:509104101065 (?) |
| 474 |
user: test |
| 475 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 476 |
summary: second |
| 477 |
|
| 478 |
$ hg resolve -l |
| 479 |
$ hg status |
| 480 |
A foo/foo |
| 481 |
? a/a.orig |
| 482 |
|
| 483 |
try to continue with no unshelve underway |
| 484 |
|
| 485 |
$ hg unshelve -c |
| 486 |
abort: no unshelve in progress |
| 487 |
[20] |
| 488 |
$ hg status |
| 489 |
A foo/foo |
| 490 |
? a/a.orig |
| 491 |
|
| 492 |
redo the unshelve to get a conflict |
| 493 |
|
| 494 |
$ hg unshelve -q |
| 495 |
warning: conflicts while merging a/a! (edit, then use 'hg resolve --mark') |
| 496 |
unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') |
| 497 |
[240] |
| 498 |
|
| 499 |
attempt to continue |
| 500 |
|
| 501 |
$ hg unshelve -c |
| 502 |
abort: unresolved conflicts, can't continue |
| 503 |
(see 'hg resolve', then 'hg unshelve --continue') |
| 504 |
[255] |
| 505 |
|
| 506 |
$ hg revert -r . a/a |
| 507 |
$ hg resolve -m a/a |
| 508 |
(no more unresolved files) |
| 509 |
continue: hg unshelve --continue |
| 510 |
|
| 511 |
$ hg commit -m 'commit while unshelve in progress' |
| 512 |
abort: unshelve already in progress |
| 513 |
(use 'hg unshelve --continue' or 'hg unshelve --abort') |
| 514 |
[20] |
| 515 |
|
| 516 |
$ hg graft --continue |
| 517 |
abort: no graft in progress |
| 518 |
(continue: hg unshelve --continue) |
| 519 |
[20] |
| 520 |
$ hg unshelve -c |
| 521 |
unshelve of 'default' complete |
| 522 |
|
| 523 |
ensure the repo is as we hope |
| 524 |
|
| 525 |
$ hg parents |
| 526 |
changeset: [37]:2e69b451d1ea (re) |
| 527 |
tag: tip |
| 528 |
parent: 3:509104101065 (?) |
| 529 |
user: test |
| 530 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 531 |
summary: second |
| 532 |
|
| 533 |
$ hg heads -q |
| 534 |
[37]:2e69b451d1ea (re) |
| 535 |
|
| 536 |
$ hg status -C |
| 537 |
A b.rename/b |
| 538 |
b/b |
| 539 |
A c.copy |
| 540 |
c |
| 541 |
A foo/foo |
| 542 |
R b/b |
| 543 |
R d |
| 544 |
? a/a.orig |
| 545 |
|
| 546 |
there should be no shelves left |
| 547 |
|
| 548 |
$ hg shelve -l |
| 549 |
|
| 550 |
#if execbit |
| 551 |
|
| 552 |
ensure that metadata-only changes are shelved |
| 553 |
|
| 554 |
$ chmod +x a/a |
| 555 |
$ hg shelve -q -n execbit a/a |
| 556 |
$ hg status a/a |
| 557 |
$ hg unshelve -q execbit |
| 558 |
$ hg status a/a |
| 559 |
M a/a |
| 560 |
$ hg revert a/a |
| 561 |
|
| 562 |
#else |
| 563 |
|
| 564 |
Dummy shelve op, to keep rev numbers aligned |
| 565 |
|
| 566 |
$ echo foo > a/a |
| 567 |
$ hg shelve -q -n dummy a/a |
| 568 |
$ hg unshelve -q dummy |
| 569 |
$ hg revert a/a |
| 570 |
|
| 571 |
#endif |
| 572 |
|
| 573 |
#if symlink |
| 574 |
|
| 575 |
$ rm a/a |
| 576 |
$ ln -s foo a/a |
| 577 |
$ hg shelve -q -n symlink a/a |
| 578 |
$ hg status a/a |
| 579 |
$ hg unshelve -q -n symlink |
| 580 |
$ hg status a/a |
| 581 |
M a/a |
| 582 |
$ hg revert a/a |
| 583 |
|
| 584 |
#else |
| 585 |
|
| 586 |
Dummy shelve op, to keep rev numbers aligned |
| 587 |
|
| 588 |
$ echo bar > a/a |
| 589 |
$ hg shelve -q -n dummy a/a |
| 590 |
$ hg unshelve -q dummy |
| 591 |
$ hg revert a/a |
| 592 |
|
| 593 |
#endif |
| 594 |
|
| 595 |
set up another conflict between a commit and a shelved change |
| 596 |
|
| 597 |
$ hg revert -q -C -a |
| 598 |
$ rm a/a.orig b.rename/b c.copy |
| 599 |
$ echo a >> a/a |
| 600 |
$ hg shelve -q |
| 601 |
$ echo x >> a/a |
| 602 |
$ hg ci -m 'create conflict' |
| 603 |
$ hg add foo/foo |
| 604 |
|
| 605 |
if we resolve a conflict while unshelving, the unshelve should succeed |
| 606 |
|
| 607 |
$ hg unshelve --tool :merge-other --keep |
| 608 |
unshelving change 'default' |
| 609 |
temporarily committing pending changes (restore with 'hg unshelve --abort') |
| 610 |
rebasing shelved changes |
| 611 |
merging a/a |
| 612 |
$ hg parents -q |
| 613 |
(4|13):33f7f61e6c5e (re) |
| 614 |
$ hg shelve -l |
| 615 |
default (*)* changes to: second (glob) |
| 616 |
$ hg status |
| 617 |
M a/a |
| 618 |
A foo/foo |
| 619 |
$ cat a/a |
| 620 |
a |
| 621 |
c |
| 622 |
a |
| 623 |
$ cat > a/a << EOF |
| 624 |
> a |
| 625 |
> c |
| 626 |
> x |
| 627 |
> EOF |
| 628 |
|
| 629 |
$ HGMERGE=true hg unshelve |
| 630 |
unshelving change 'default' |
| 631 |
temporarily committing pending changes (restore with 'hg unshelve --abort') |
| 632 |
rebasing shelved changes |
| 633 |
merging a/a |
| 634 |
note: unshelved changes already existed in the working copy |
| 635 |
$ hg parents -q |
| 636 |
(4|13):33f7f61e6c5e (re) |
| 637 |
$ hg shelve -l |
| 638 |
$ hg status |
| 639 |
A foo/foo |
| 640 |
$ cat a/a |
| 641 |
a |
| 642 |
c |
| 643 |
x |
| 644 |
|
| 645 |
test keep and cleanup |
| 646 |
|
| 647 |
$ hg shelve |
| 648 |
shelved as default |
| 649 |
0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 650 |
$ hg shelve --list |
| 651 |
default (*)* changes to: create conflict (glob) |
| 652 |
$ hg unshelve -k |
| 653 |
unshelving change 'default' |
| 654 |
$ hg shelve --list |
| 655 |
default (*)* changes to: create conflict (glob) |
| 656 |
$ hg shelve --cleanup |
| 657 |
$ hg shelve --list |
| 658 |
|
| 659 |
$ hg shelve --cleanup --delete |
| 660 |
abort: options '--cleanup' and '--delete' may not be used together |
| 661 |
[10] |
| 662 |
$ hg shelve --cleanup --patch |
| 663 |
abort: options '--cleanup' and '--patch' may not be used together |
| 664 |
[10] |
| 665 |
$ hg shelve --cleanup --message MESSAGE |
| 666 |
abort: options '--cleanup' and '--message' may not be used together |
| 667 |
[10] |
| 668 |
|
| 669 |
test bookmarks |
| 670 |
|
| 671 |
$ hg bookmark test |
| 672 |
$ hg bookmark |
| 673 |
\* test (4|13):33f7f61e6c5e (re) |
| 674 |
$ hg shelve |
| 675 |
shelved as test |
| 676 |
0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 677 |
$ hg bookmark |
| 678 |
\* test (4|13):33f7f61e6c5e (re) |
| 679 |
$ hg unshelve |
| 680 |
unshelving change 'test' |
| 681 |
$ hg bookmark |
| 682 |
\* test (4|13):33f7f61e6c5e (re) |
| 683 |
|
| 684 |
shelve should still work even if mq is disabled |
| 685 |
|
| 686 |
$ hg --config extensions.mq=! shelve |
| 687 |
shelved as test |
| 688 |
0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 689 |
$ hg --config extensions.mq=! shelve --list |
| 690 |
test (*)* changes to: create conflict (glob) |
| 691 |
$ hg bookmark |
| 692 |
\* test (4|13):33f7f61e6c5e (re) |
| 693 |
$ hg --config extensions.mq=! unshelve |
| 694 |
unshelving change 'test' |
| 695 |
$ hg bookmark |
| 696 |
\* test (4|13):33f7f61e6c5e (re) |
| 697 |
|
| 698 |
Recreate some conflict again |
| 699 |
|
| 700 |
$ hg up -C -r 2e69b451d1ea |
| 701 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 702 |
(leaving bookmark test) |
| 703 |
$ echo y >> a/a |
| 704 |
$ hg shelve |
| 705 |
shelved as default |
| 706 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 707 |
$ hg up test |
| 708 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 709 |
(activating bookmark test) |
| 710 |
$ hg bookmark |
| 711 |
\* test (4|13):33f7f61e6c5e (re) |
| 712 |
$ hg unshelve |
| 713 |
unshelving change 'default' |
| 714 |
rebasing shelved changes |
| 715 |
merging a/a |
| 716 |
warning: conflicts while merging a/a! (edit, then use 'hg resolve --mark') |
| 717 |
unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') |
| 718 |
[240] |
| 719 |
$ hg bookmark |
| 720 |
test (4|13):33f7f61e6c5e (re) |
| 721 |
|
| 722 |
Test that resolving all conflicts in one direction (so that the rebase |
| 723 |
is a no-op), works (issue4398) |
| 724 |
|
| 725 |
$ hg revert -a -r . |
| 726 |
reverting a/a |
| 727 |
$ hg resolve -m a/a |
| 728 |
(no more unresolved files) |
| 729 |
continue: hg unshelve --continue |
| 730 |
$ hg unshelve -c |
| 731 |
note: unshelved changes already existed in the working copy |
| 732 |
unshelve of 'default' complete |
| 733 |
$ hg bookmark |
| 734 |
\* test (4|13):33f7f61e6c5e (re) |
| 735 |
$ hg diff |
| 736 |
$ hg status |
| 737 |
? a/a.orig |
| 738 |
? foo/foo |
| 739 |
$ hg summary |
| 740 |
parent: (4|13):33f7f61e6c5e tip (re) |
| 741 |
create conflict |
| 742 |
branch: default |
| 743 |
bookmarks: *test |
| 744 |
commit: 2 unknown (clean) |
| 745 |
update: (current) |
| 746 |
phases: 5 draft |
| 747 |
|
| 748 |
$ hg shelve --delete --stat |
| 749 |
abort: options '--delete' and '--stat' may not be used together |
| 750 |
[10] |
| 751 |
$ hg shelve --delete --name NAME |
| 752 |
abort: options '--delete' and '--name' may not be used together |
| 753 |
[10] |
| 754 |
|
| 755 |
Test interactive shelve |
| 756 |
$ cat <<EOF >> $HGRCPATH |
| 757 |
> [ui] |
| 758 |
> interactive = true |
| 759 |
> EOF |
| 760 |
$ echo 'a' >> a/b |
| 761 |
$ cat a/a >> a/b |
| 762 |
$ echo 'x' >> a/b |
| 763 |
$ mv a/b a/a |
| 764 |
$ echo 'a' >> foo/foo |
| 765 |
$ hg st |
| 766 |
M a/a |
| 767 |
? a/a.orig |
| 768 |
? foo/foo |
| 769 |
$ cat a/a |
| 770 |
a |
| 771 |
a |
| 772 |
c |
| 773 |
x |
| 774 |
x |
| 775 |
$ cat foo/foo |
| 776 |
foo |
| 777 |
a |
| 778 |
$ hg shelve --interactive --config ui.interactive=false |
| 779 |
abort: running non-interactively |
| 780 |
[10] |
| 781 |
$ hg shelve --interactive << EOF |
| 782 |
> y |
| 783 |
> y |
| 784 |
> n |
| 785 |
> EOF |
| 786 |
diff --git a/a/a b/a/a |
| 787 |
2 hunks, 2 lines changed |
| 788 |
examine changes to 'a/a'? |
| 789 |
(enter ? for help) [Ynesfdaq?] y |
| 790 |
|
| 791 |
@@ -1,3 +1,4 @@ |
| 792 |
+a |
| 793 |
a |
| 794 |
c |
| 795 |
x |
| 796 |
record change 1/2 to 'a/a'? |
| 797 |
(enter ? for help) [Ynesfdaq?] y |
| 798 |
|
| 799 |
@@ -1,3 +2,4 @@ |
| 800 |
a |
| 801 |
c |
| 802 |
x |
| 803 |
+x |
| 804 |
record change 2/2 to 'a/a'? |
| 805 |
(enter ? for help) [Ynesfdaq?] n |
| 806 |
|
| 807 |
shelved as test |
| 808 |
merging a/a |
| 809 |
0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
| 810 |
$ cat a/a |
| 811 |
a |
| 812 |
c |
| 813 |
x |
| 814 |
x |
| 815 |
$ cat foo/foo |
| 816 |
foo |
| 817 |
a |
| 818 |
$ hg st |
| 819 |
M a/a |
| 820 |
? foo/foo |
| 821 |
$ hg bookmark |
| 822 |
\* test (4|13):33f7f61e6c5e (re) |
| 823 |
there shouldn't be a merge state |
| 824 |
$ hg resolve -l |
| 825 |
$ hg unshelve |
| 826 |
unshelving change 'test' |
| 827 |
temporarily committing pending changes (restore with 'hg unshelve --abort') |
| 828 |
rebasing shelved changes |
| 829 |
merging a/a |
| 830 |
$ hg bookmark |
| 831 |
\* test (4|13):33f7f61e6c5e (re) |
| 832 |
$ cat a/a |
| 833 |
a |
| 834 |
a |
| 835 |
c |
| 836 |
x |
| 837 |
x |
| 838 |
|
| 839 |
shelve --patch and shelve --stat should work with valid shelfnames |
| 840 |
|
| 841 |
$ hg up --clean . |
| 842 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 843 |
(leaving bookmark test) |
| 844 |
$ hg shelve --list |
| 845 |
$ echo 'patch a' > shelf-patch-a |
| 846 |
$ hg add shelf-patch-a |
| 847 |
$ hg shelve |
| 848 |
shelved as default |
| 849 |
0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 850 |
$ echo 'patch b' > shelf-patch-b |
| 851 |
$ hg add shelf-patch-b |
| 852 |
$ hg shelve |
| 853 |
shelved as default-01 |
| 854 |
0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 855 |
$ hg shelve --patch default default-01 |
| 856 |
default-01 (*)* changes to: create conflict (glob) |
| 857 |
|
| 858 |
diff --git a/shelf-patch-b b/shelf-patch-b |
| 859 |
new file mode 100644 |
| 860 |
--- /dev/null |
| 861 |
+++ b/shelf-patch-b |
| 862 |
@@ -0,0 +1,1 @@ |
| 863 |
+patch b |
| 864 |
default (*)* changes to: create conflict (glob) |
| 865 |
|
| 866 |
diff --git a/shelf-patch-a b/shelf-patch-a |
| 867 |
new file mode 100644 |
| 868 |
--- /dev/null |
| 869 |
+++ b/shelf-patch-a |
| 870 |
@@ -0,0 +1,1 @@ |
| 871 |
+patch a |
| 872 |
$ hg shelve --stat default default-01 |
| 873 |
default-01 (*)* changes to: create conflict (glob) |
| 874 |
shelf-patch-b | 1 + |
| 875 |
1 files changed, 1 insertions(+), 0 deletions(-) |
| 876 |
default (*)* changes to: create conflict (glob) |
| 877 |
shelf-patch-a | 1 + |
| 878 |
1 files changed, 1 insertions(+), 0 deletions(-) |
| 879 |
$ hg shelve --patch default |
| 880 |
default (*)* changes to: create conflict (glob) |
| 881 |
|
| 882 |
diff --git a/shelf-patch-a b/shelf-patch-a |
| 883 |
new file mode 100644 |
| 884 |
--- /dev/null |
| 885 |
+++ b/shelf-patch-a |
| 886 |
@@ -0,0 +1,1 @@ |
| 887 |
+patch a |
| 888 |
$ hg shelve --stat default |
| 889 |
default (*)* changes to: create conflict (glob) |
| 890 |
shelf-patch-a | 1 + |
| 891 |
1 files changed, 1 insertions(+), 0 deletions(-) |
| 892 |
$ hg shelve --patch nonexistentshelf |
| 893 |
abort: cannot find shelf nonexistentshelf |
| 894 |
[255] |
| 895 |
$ hg shelve --stat nonexistentshelf |
| 896 |
abort: cannot find shelf nonexistentshelf |
| 897 |
[255] |
| 898 |
$ hg shelve --patch default nonexistentshelf |
| 899 |
abort: cannot find shelf nonexistentshelf |
| 900 |
[255] |
| 901 |
|
| 902 |
when the user asks for a patch, we assume they want the most recent shelve if |
| 903 |
they don't provide a shelve name |
| 904 |
|
| 905 |
$ hg shelve --patch |
| 906 |
default-01 (*)* changes to: create conflict (glob) |
| 907 |
|
| 908 |
diff --git a/shelf-patch-b b/shelf-patch-b |
| 909 |
new file mode 100644 |
| 910 |
--- /dev/null |
| 911 |
+++ b/shelf-patch-b |
| 912 |
@@ -0,0 +1,1 @@ |
| 913 |
+patch b |
| 914 |
|
| 915 |
$ cd .. |
| 916 |
|
| 917 |
Shelve from general delta repo uses bundle2 on disk |
| 918 |
-------------------------------------------------- |
| 919 |
|
| 920 |
no general delta |
| 921 |
|
| 922 |
$ hg clone --pull repo bundle1 --config format.usegeneraldelta=0 |
| 923 |
requesting all changes |
| 924 |
adding changesets |
| 925 |
adding manifests |
| 926 |
adding file changes |
| 927 |
added 5 changesets with 8 changes to 6 files |
| 928 |
new changesets cc01e2b0c59f:33f7f61e6c5e |
| 929 |
updating to branch default |
| 930 |
6 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 931 |
$ cd bundle1 |
| 932 |
$ echo babar > jungle |
| 933 |
$ hg add jungle |
| 934 |
$ hg shelve |
| 935 |
shelved as default |
| 936 |
0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 937 |
$ hg debugbundle .hg/shelved/*.hg |
| 938 |
330882a04d2ce8487636b1fb292e5beea77fa1e3 |
| 939 |
$ cd .. |
| 940 |
|
| 941 |
with general delta |
| 942 |
|
| 943 |
$ hg clone --pull repo bundle2 --config format.usegeneraldelta=1 |
| 944 |
requesting all changes |
| 945 |
adding changesets |
| 946 |
adding manifests |
| 947 |
adding file changes |
| 948 |
added 5 changesets with 8 changes to 6 files |
| 949 |
new changesets cc01e2b0c59f:33f7f61e6c5e |
| 950 |
updating to branch default |
| 951 |
6 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 952 |
$ cd bundle2 |
| 953 |
$ echo babar > jungle |
| 954 |
$ hg add jungle |
| 955 |
$ hg shelve |
| 956 |
shelved as default |
| 957 |
0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 958 |
$ hg debugbundle .hg/shelved/*.hg |
| 959 |
Stream params: {Compression: BZ} |
| 960 |
changegroup -- {nbchanges: 1, version: 02} (mandatory: True) |
| 961 |
330882a04d2ce8487636b1fb292e5beea77fa1e3 |
| 962 |
|
| 963 |
Test shelve --keep |
| 964 |
|
| 965 |
$ hg unshelve |
| 966 |
unshelving change 'default' |
| 967 |
$ hg shelve --keep --list |
| 968 |
abort: options '--list' and '--keep' may not be used together |
| 969 |
[10] |
| 970 |
$ hg shelve --keep --patch |
| 971 |
abort: options '--patch' and '--keep' may not be used together |
| 972 |
[10] |
| 973 |
$ hg shelve --keep --delete |
| 974 |
abort: options '--delete' and '--keep' may not be used together |
| 975 |
[10] |
| 976 |
$ hg shelve --keep |
| 977 |
shelved as default |
| 978 |
$ hg diff |
| 979 |
diff --git a/jungle b/jungle |
| 980 |
new file mode 100644 |
| 981 |
--- /dev/null |
| 982 |
+++ b/jungle |
| 983 |
@@ -0,0 +1,1 @@ |
| 984 |
+babar |
| 985 |
|
| 986 |
Test shelve --delete |
| 987 |
|
| 988 |
$ hg shelve --list |
| 989 |
default (*s ago) * changes to: create conflict (glob) |
| 990 |
$ hg shelve --delete doesnotexist |
| 991 |
abort: shelved change 'doesnotexist' not found |
| 992 |
[10] |
| 993 |
$ hg shelve --delete default |
| 994 |
|
| 995 |
$ cd .. |
| 996 |
|
| 997 |
Test visibility of in-memory changes inside transaction to external hook |
| 998 |
------------------------------------------------------------------------ |
| 999 |
|
| 1000 |
$ cd repo |
| 1001 |
|
| 1002 |
$ echo xxxx >> x |
| 1003 |
$ hg commit -m "#5: changes to invoke rebase" |
| 1004 |
|
| 1005 |
$ cat > $TESTTMP/checkvisibility.sh <<EOF |
| 1006 |
> echo "==== \$1:" |
| 1007 |
> hg parents --template "VISIBLE {rev}:{node|short}\n" |
| 1008 |
> # test that pending changes are hidden |
| 1009 |
> unset HG_PENDING |
| 1010 |
> hg parents --template "ACTUAL {rev}:{node|short}\n" |
| 1011 |
> echo "====" |
| 1012 |
> EOF |
| 1013 |
|
| 1014 |
$ cat >> .hg/hgrc <<EOF |
| 1015 |
> [defaults] |
| 1016 |
> # to fix hash id of temporary revisions |
| 1017 |
> unshelve = --date '0 0' |
| 1018 |
> EOF |
| 1019 |
|
| 1020 |
"hg unshelve" at REV5 implies steps below: |
| 1021 |
|
| 1022 |
(1) commit changes in the working directory (REV6) |
| 1023 |
(2) unbundle shelved revision (REV7) |
| 1024 |
(3) rebase: merge REV7 into REV6 (REV6 => REV6, REV7) |
| 1025 |
(4) rebase: commit merged revision (REV8) |
| 1026 |
(5) rebase: update to REV6 (REV8 => REV6) |
| 1027 |
(6) update to REV5 (REV6 => REV5) |
| 1028 |
(7) abort transaction |
| 1029 |
|
| 1030 |
== test visibility to external preupdate hook |
| 1031 |
|
| 1032 |
$ cat >> .hg/hgrc <<EOF |
| 1033 |
> [hooks] |
| 1034 |
> preupdate.visibility = sh $TESTTMP/checkvisibility.sh preupdate |
| 1035 |
> EOF |
| 1036 |
|
| 1037 |
$ echo nnnn >> n |
| 1038 |
|
| 1039 |
$ sh $TESTTMP/checkvisibility.sh before-unshelving |
| 1040 |
==== before-unshelving: |
| 1041 |
VISIBLE (5|19):703117a2acfb (re) |
| 1042 |
ACTUAL (5|19):703117a2acfb (re) |
| 1043 |
==== |
| 1044 |
|
| 1045 |
$ hg unshelve --keep default |
| 1046 |
temporarily committing pending changes (restore with 'hg unshelve --abort') |
| 1047 |
rebasing shelved changes |
| 1048 |
==== preupdate: |
| 1049 |
VISIBLE (6|20):54c00d20fb3f (re) |
| 1050 |
ACTUAL (5|19):703117a2acfb (re) |
| 1051 |
==== |
| 1052 |
==== preupdate: |
| 1053 |
VISIBLE (8|21):8efe6f7537dc (re) |
| 1054 |
ACTUAL (5|19):703117a2acfb (re) |
| 1055 |
==== |
| 1056 |
==== preupdate: |
| 1057 |
VISIBLE (6|20):54c00d20fb3f (re) |
| 1058 |
ACTUAL (5|19):703117a2acfb (re) |
| 1059 |
==== |
| 1060 |
|
| 1061 |
$ cat >> .hg/hgrc <<EOF |
| 1062 |
> [hooks] |
| 1063 |
> preupdate.visibility = |
| 1064 |
> EOF |
| 1065 |
|
| 1066 |
$ sh $TESTTMP/checkvisibility.sh after-unshelving |
| 1067 |
==== after-unshelving: |
| 1068 |
VISIBLE (5|19):703117a2acfb (re) |
| 1069 |
ACTUAL (5|19):703117a2acfb (re) |
| 1070 |
==== |
| 1071 |
|
| 1072 |
== test visibility to external update hook |
| 1073 |
|
| 1074 |
$ hg update -q -C 703117a2acfb |
| 1075 |
|
| 1076 |
$ cat >> .hg/hgrc <<EOF |
| 1077 |
> [hooks] |
| 1078 |
> update.visibility = sh $TESTTMP/checkvisibility.sh update |
| 1079 |
> EOF |
| 1080 |
|
| 1081 |
$ echo nnnn >> n |
| 1082 |
|
| 1083 |
$ sh $TESTTMP/checkvisibility.sh before-unshelving |
| 1084 |
==== before-unshelving: |
| 1085 |
VISIBLE (5|19):703117a2acfb (re) |
| 1086 |
ACTUAL (5|19):703117a2acfb (re) |
| 1087 |
==== |
| 1088 |
|
| 1089 |
$ hg unshelve --keep default |
| 1090 |
temporarily committing pending changes (restore with 'hg unshelve --abort') |
| 1091 |
rebasing shelved changes |
| 1092 |
==== update: |
| 1093 |
VISIBLE (6|20):54c00d20fb3f (re) |
| 1094 |
VISIBLE 1?7:492ed9d705e5 (re) |
| 1095 |
ACTUAL (5|19):703117a2acfb (re) |
| 1096 |
==== |
| 1097 |
==== update: |
| 1098 |
VISIBLE (6|20):54c00d20fb3f (re) |
| 1099 |
ACTUAL (5|19):703117a2acfb (re) |
| 1100 |
==== |
| 1101 |
==== update: |
| 1102 |
VISIBLE (5|19):703117a2acfb (re) |
| 1103 |
ACTUAL (5|19):703117a2acfb (re) |
| 1104 |
==== |
| 1105 |
|
| 1106 |
$ cat >> .hg/hgrc <<EOF |
| 1107 |
> [hooks] |
| 1108 |
> update.visibility = |
| 1109 |
> EOF |
| 1110 |
|
| 1111 |
$ sh $TESTTMP/checkvisibility.sh after-unshelving |
| 1112 |
==== after-unshelving: |
| 1113 |
VISIBLE (5|19):703117a2acfb (re) |
| 1114 |
ACTUAL (5|19):703117a2acfb (re) |
| 1115 |
==== |
| 1116 |
|
| 1117 |
$ cd .. |
| 1118 |
|
| 1119 |
Keep active bookmark while (un)shelving even on shared repo (issue4940) |
| 1120 |
----------------------------------------------------------------------- |
| 1121 |
|
| 1122 |
$ cat <<EOF >> $HGRCPATH |
| 1123 |
> [extensions] |
| 1124 |
> share = |
| 1125 |
> EOF |
| 1126 |
|
| 1127 |
$ hg bookmarks -R repo |
| 1128 |
test (4|13):33f7f61e6c5e (re) |
| 1129 |
$ hg share -B repo share |
| 1130 |
updating working directory |
| 1131 |
6 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 1132 |
$ cd share |
| 1133 |
|
| 1134 |
$ hg bookmarks |
| 1135 |
test (4|13):33f7f61e6c5e (re) |
| 1136 |
$ hg bookmarks foo |
| 1137 |
$ hg bookmarks |
| 1138 |
\* foo (5|19):703117a2acfb (re) |
| 1139 |
test (4|13):33f7f61e6c5e (re) |
| 1140 |
$ echo x >> x |
| 1141 |
$ hg shelve |
| 1142 |
shelved as foo |
| 1143 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 1144 |
$ hg bookmarks |
| 1145 |
\* foo (5|19):703117a2acfb (re) |
| 1146 |
test (4|13):33f7f61e6c5e (re) |
| 1147 |
|
| 1148 |
$ hg unshelve |
| 1149 |
unshelving change 'foo' |
| 1150 |
$ hg bookmarks |
| 1151 |
\* foo (5|19):703117a2acfb (re) |
| 1152 |
test (4|13):33f7f61e6c5e (re) |
| 1153 |
|
| 1154 |
$ cd .. |
| 1155 |
|
| 1156 |
Abort unshelve while merging (issue5123) |
| 1157 |
---------------------------------------- |
| 1158 |
|
| 1159 |
$ hg init issue5123 |
| 1160 |
$ cd issue5123 |
| 1161 |
$ echo > a |
| 1162 |
$ hg ci -Am a |
| 1163 |
adding a |
| 1164 |
$ hg co null |
| 1165 |
0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 1166 |
$ echo > b |
| 1167 |
$ hg ci -Am b |
| 1168 |
adding b |
| 1169 |
created new head |
| 1170 |
$ echo > c |
| 1171 |
$ hg add c |
| 1172 |
$ hg shelve |
| 1173 |
shelved as default |
| 1174 |
0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 1175 |
$ hg co 1 |
| 1176 |
0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 1177 |
$ hg merge 0 |
| 1178 |
1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 1179 |
(branch merge, don't forget to commit) |
| 1180 |
-- successful merge with two parents |
| 1181 |
$ hg log -G |
| 1182 |
@ changeset: 1:406bf70c274f |
| 1183 |
tag: tip |
| 1184 |
parent: -1:000000000000 |
| 1185 |
user: test |
| 1186 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 1187 |
summary: b |
| 1188 |
|
| 1189 |
@ changeset: 0:ada8c9eb8252 |
| 1190 |
user: test |
| 1191 |
date: Thu Jan 01 00:00:00 1970 +0000 |
| 1192 |
summary: a |
| 1193 |
|
| 1194 |
-- trying to pull in the shelve bits |
| 1195 |
-- unshelve should abort otherwise, it'll eat my second parent. |
| 1196 |
$ hg unshelve |
| 1197 |
abort: outstanding uncommitted merge |
| 1198 |
(use 'hg commit' or 'hg merge --abort') |
| 1199 |
[20] |
| 1200 |
|
| 1201 |
$ cd .. |
| 1202 |
|
| 1203 |
-- test for interactive mode on unshelve |
| 1204 |
|
| 1205 |
$ hg init a |
| 1206 |
$ cd a |
| 1207 |
$ echo > b |
| 1208 |
$ hg ci -Am b |
| 1209 |
adding b |
| 1210 |
$ echo > c |
| 1211 |
$ echo > d |
| 1212 |
$ hg add . |
| 1213 |
adding c |
| 1214 |
adding d |
| 1215 |
$ hg shelve |
| 1216 |
shelved as default |
| 1217 |
0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
| 1218 |
$ echo > e |
| 1219 |
$ hg add e |
| 1220 |
$ hg ci -m e |
| 1221 |
$ hg shelve --patch |
| 1222 |
default (*s ago) * changes to: b (glob) |
| 1223 |
|
| 1224 |
diff --git a/c b/c |
| 1225 |
new file mode 100644 |
| 1226 |
--- /dev/null |
| 1227 |
+++ b/c |
| 1228 |
@@ -0,0 +1,1 @@ |
| 1229 |
+ |
| 1230 |
diff --git a/d b/d |
| 1231 |
new file mode 100644 |
| 1232 |
--- /dev/null |
| 1233 |
+++ b/d |
| 1234 |
@@ -0,0 +1,1 @@ |
| 1235 |
+ |
| 1236 |
$ hg unshelve -i <<EOF |
| 1237 |
> y |
| 1238 |
> y |
| 1239 |
> y |
| 1240 |
> n |
| 1241 |
> EOF |
| 1242 |
unshelving change 'default' |
| 1243 |
rebasing shelved changes |
| 1244 |
diff --git a/c b/c |
| 1245 |
new file mode 100644 |
| 1246 |
examine changes to 'c'? |
| 1247 |
(enter ? for help) [Ynesfdaq?] y |
| 1248 |
|
| 1249 |
@@ -0,0 +1,1 @@ |
| 1250 |
+ |
| 1251 |
record change 1/2 to 'c'? |
| 1252 |
(enter ? for help) [Ynesfdaq?] y |
| 1253 |
|
| 1254 |
diff --git a/d b/d |
| 1255 |
new file mode 100644 |
| 1256 |
examine changes to 'd'? |
| 1257 |
(enter ? for help) [Ynesfdaq?] y |
| 1258 |
|
| 1259 |
@@ -0,0 +1,1 @@ |
| 1260 |
+ |
| 1261 |
record change 2/2 to 'd'? |
| 1262 |
(enter ? for help) [Ynesfdaq?] n |
| 1263 |
|
| 1264 |
$ ls -A |
| 1265 |
.hg |
| 1266 |
b |
| 1267 |
c |
| 1268 |
e |
| 1269 |
-- shelve should not contain `c` now |
| 1270 |
$ hg shelve --patch |
| 1271 |
default (*s ago) * changes to: b (glob) |
| 1272 |
|
| 1273 |
diff --git a/d b/d |
| 1274 |
new file mode 100644 |
| 1275 |
--- /dev/null |
| 1276 |
+++ b/d |
| 1277 |
@@ -0,0 +1,1 @@ |
| 1278 |
+ |
| 1279 |
$ hg unshelve -i <<EOF |
| 1280 |
> y |
| 1281 |
> y |
| 1282 |
> EOF |
| 1283 |
unshelving change 'default' |
| 1284 |
temporarily committing pending changes (restore with 'hg unshelve --abort') |
| 1285 |
rebasing shelved changes |
| 1286 |
diff --git a/d b/d |
| 1287 |
new file mode 100644 |
| 1288 |
examine changes to 'd'? |
| 1289 |
(enter ? for help) [Ynesfdaq?] y |
| 1290 |
|
| 1291 |
@@ -0,0 +1,1 @@ |
| 1292 |
+ |
| 1293 |
record this change to 'd'? |
| 1294 |
(enter ? for help) [Ynesfdaq?] y |
| 1295 |
|
| 1296 |
|
| 1297 |
$ hg status -v |
| 1298 |
A c |
| 1299 |
A d |
| 1300 |
$ ls -A |
| 1301 |
.hg |
| 1302 |
b |
| 1303 |
c |
| 1304 |
d |
| 1305 |
e |
| 1306 |
$ hg shelve --list |
| 1307 |
|
| 1308 |
-- now, unshelve selected changes from a file |
| 1309 |
|
| 1310 |
$ echo B > foo |
| 1311 |
$ hg add foo |
| 1312 |
$ hg ci -m 'add B to foo' |
| 1313 |
$ cat > foo <<EOF |
| 1314 |
> A |
| 1315 |
> B |
| 1316 |
> C |
| 1317 |
> EOF |
| 1318 |
$ echo > garbage |
| 1319 |
$ hg st |
| 1320 |
M foo |
| 1321 |
? garbage |
| 1322 |
$ hg shelve --unknown |
| 1323 |
shelved as default |
| 1324 |
1 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 1325 |
$ cat foo |
| 1326 |
B |
| 1327 |
$ hg unshelve -i <<EOF |
| 1328 |
> y |
| 1329 |
> y |
| 1330 |
> n |
| 1331 |
> y |
| 1332 |
> y |
| 1333 |
> EOF |
| 1334 |
unshelving change 'default' |
| 1335 |
rebasing shelved changes |
| 1336 |
diff --git a/foo b/foo |
| 1337 |
2 hunks, 2 lines changed |
| 1338 |
examine changes to 'foo'? |
| 1339 |
(enter ? for help) [Ynesfdaq?] y |
| 1340 |
|
| 1341 |
@@ -1,1 +1,2 @@ |
| 1342 |
+A |
| 1343 |
B |
| 1344 |
record change 1/3 to 'foo'? |
| 1345 |
(enter ? for help) [Ynesfdaq?] y |
| 1346 |
|
| 1347 |
@@ -1,1 +2,2 @@ |
| 1348 |
B |
| 1349 |
+C |
| 1350 |
record change 2/3 to 'foo'? |
| 1351 |
(enter ? for help) [Ynesfdaq?] n |
| 1352 |
|
| 1353 |
diff --git a/garbage b/garbage |
| 1354 |
new file mode 100644 |
| 1355 |
examine changes to 'garbage'? |
| 1356 |
(enter ? for help) [Ynesfdaq?] y |
| 1357 |
|
| 1358 |
@@ -0,0 +1,1 @@ |
| 1359 |
+ |
| 1360 |
record change 3/3 to 'garbage'? |
| 1361 |
(enter ? for help) [Ynesfdaq?] y |
| 1362 |
|
| 1363 |
$ hg st |
| 1364 |
M foo |
| 1365 |
? garbage |
| 1366 |
$ cat foo |
| 1367 |
A |
| 1368 |
B |
| 1369 |
$ hg shelve --patch |
| 1370 |
default (*s ago) * changes to: add B to foo (glob) |
| 1371 |
|
| 1372 |
diff --git a/foo b/foo |
| 1373 |
--- a/foo |
| 1374 |
+++ b/foo |
| 1375 |
@@ -1,2 +1,3 @@ |
| 1376 |
A |
| 1377 |
B |
| 1378 |
+C |
| 1379 |
|
| 1380 |
-- unshelve interactive on conflicts |
| 1381 |
|
| 1382 |
$ echo A >> bar1 |
| 1383 |
$ echo A >> bar2 |
| 1384 |
$ hg add bar1 bar2 |
| 1385 |
$ hg ci -m 'add A to bars' |
| 1386 |
$ echo B >> bar1 |
| 1387 |
$ echo B >> bar2 |
| 1388 |
$ hg shelve |
| 1389 |
shelved as default-01 |
| 1390 |
2 files updated, 0 files merged, 0 files removed, 0 files unresolved |
| 1391 |
$ echo C >> bar1 |
| 1392 |
$ echo C >> bar2 |
| 1393 |
$ hg ci -m 'add C to bars' |
| 1394 |
$ hg unshelve -i |
| 1395 |
unshelving change 'default-01' |
| 1396 |
rebasing shelved changes |
| 1397 |
merging bar1 |
| 1398 |
warning: conflicts while merging bar1! (edit, then use 'hg resolve --mark') |
| 1399 |
merging bar2 |
| 1400 |
warning: conflicts while merging bar2! (edit, then use 'hg resolve --mark') |
| 1401 |
unresolved conflicts (see 'hg resolve', then 'hg unshelve --continue') |
| 1402 |
[240] |
| 1403 |
|
| 1404 |
$ cat > bar1 <<EOF |
| 1405 |
> A |
| 1406 |
> B |
| 1407 |
> C |
| 1408 |
> EOF |
| 1409 |
$ cat > bar2 <<EOF |
| 1410 |
> A |
| 1411 |
> B |
| 1412 |
> C |
| 1413 |
> EOF |
| 1414 |
$ hg resolve -m bar1 bar2 |
| 1415 |
(no more unresolved files) |
| 1416 |
continue: hg unshelve --continue |
| 1417 |
|
| 1418 |
-- using --continue with --interactive should throw an error |
| 1419 |
$ hg unshelve --continue -i |
| 1420 |
abort: cannot use both continue and interactive |
| 1421 |
[10] |
| 1422 |
|
| 1423 |
$ cat bar1 |
| 1424 |
A |
| 1425 |
B |
| 1426 |
C |
| 1427 |
|
| 1428 |
#if stripbased |
| 1429 |
$ hg log -r 3:: -G |
| 1430 |
@ changeset: 5:f1d5f53e397b |
| 1431 |
| tag: tip |
| 1432 |
| parent: 3:e28fd7fa7938 |
| 1433 |
| user: shelve@localhost |
| 1434 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 1435 |
| summary: changes to: add A to bars |
| 1436 |
| |
| 1437 |
| @ changeset: 4:fe451a778c81 |
| 1438 |
|/ user: test |
| 1439 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 1440 |
| summary: add C to bars |
| 1441 |
| |
| 1442 |
o changeset: 3:e28fd7fa7938 |
| 1443 |
| user: test |
| 1444 |
~ date: Thu Jan 01 00:00:00 1970 +0000 |
| 1445 |
summary: add A to bars |
| 1446 |
|
| 1447 |
#endif |
| 1448 |
|
| 1449 |
$ hg unshelve --continue <<EOF |
| 1450 |
> y |
| 1451 |
> y |
| 1452 |
> y |
| 1453 |
> n |
| 1454 |
> EOF |
| 1455 |
diff --git a/bar1 b/bar1 |
| 1456 |
1 hunks, 1 lines changed |
| 1457 |
examine changes to 'bar1'? |
| 1458 |
(enter ? for help) [Ynesfdaq?] y |
| 1459 |
|
| 1460 |
@@ -1,2 +1,3 @@ |
| 1461 |
A |
| 1462 |
+B |
| 1463 |
C |
| 1464 |
record change 1/2 to 'bar1'? |
| 1465 |
(enter ? for help) [Ynesfdaq?] y |
| 1466 |
|
| 1467 |
diff --git a/bar2 b/bar2 |
| 1468 |
1 hunks, 1 lines changed |
| 1469 |
examine changes to 'bar2'? |
| 1470 |
(enter ? for help) [Ynesfdaq?] y |
| 1471 |
|
| 1472 |
@@ -1,2 +1,3 @@ |
| 1473 |
A |
| 1474 |
+B |
| 1475 |
C |
| 1476 |
record change 2/2 to 'bar2'? |
| 1477 |
(enter ? for help) [Ynesfdaq?] n |
| 1478 |
|
| 1479 |
unshelve of 'default-01' complete |
| 1480 |
|
| 1481 |
#if stripbased |
| 1482 |
$ hg log -r 3:: -G |
| 1483 |
@ changeset: 4:fe451a778c81 |
| 1484 |
| tag: tip |
| 1485 |
| user: test |
| 1486 |
| date: Thu Jan 01 00:00:00 1970 +0000 |
| 1487 |
| summary: add C to bars |
| 1488 |
| |
| 1489 |
o changeset: 3:e28fd7fa7938 |
| 1490 |
| user: test |
| 1491 |
~ date: Thu Jan 01 00:00:00 1970 +0000 |
| 1492 |
summary: add A to bars |
| 1493 |
|
| 1494 |
#endif |
| 1495 |
|
| 1496 |
$ hg unshelve --continue |
| 1497 |
abort: no unshelve in progress |
| 1498 |
[20] |
| 1499 |
|
| 1500 |
$ hg shelve --list |
| 1501 |
default-01 (*)* changes to: add A to bars (glob) |
| 1502 |
default (*)* changes to: add B to foo (glob) |
| 1503 |
$ hg unshelve -n default-01 -i <<EOF |
| 1504 |
> y |
| 1505 |
> y |
| 1506 |
> EOF |
| 1507 |
temporarily committing pending changes (restore with 'hg unshelve --abort') |
| 1508 |
rebasing shelved changes |
| 1509 |
diff --git a/bar2 b/bar2 |
| 1510 |
1 hunks, 1 lines changed |
| 1511 |
examine changes to 'bar2'? |
| 1512 |
(enter ? for help) [Ynesfdaq?] y |
| 1513 |
|
| 1514 |
@@ -1,2 +1,3 @@ |
| 1515 |
A |
| 1516 |
+B |
| 1517 |
C |
| 1518 |
record this change to 'bar2'? |
| 1519 |
(enter ? for help) [Ynesfdaq?] y |
| 1520 |
|
| 1521 |
-- test for --interactive --keep |
| 1522 |
$ hg unshelve -i --keep |
| 1523 |
abort: --keep on --interactive is not yet supported |
| 1524 |
[10] |
| 1525 |
|
| 1526 |
$ hg update -q --clean . |
| 1527 |
|
| 1528 |
Test that we can successfully shelve and unshelve a file with a trailing space |
| 1529 |
in the filename. Such filenames are supposedly unsupported on Windows, so we |
| 1530 |
wrap it in the no-windows check. Also test `hg patch` of the .patch file |
| 1531 |
produced by `hg shelve`. |
| 1532 |
#if no-windows |
| 1533 |
$ echo hi > 'my filename ' |
| 1534 |
$ hg add 'my filename ' |
| 1535 |
warning: filename ends with ' ', which is not allowed on Windows: 'my filename ' |
| 1536 |
$ hg shelve |
| 1537 |
shelved as default-01 |
| 1538 |
0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
| 1539 |
$ cp .hg/shelved/default-01.patch test_patch.patch |
| 1540 |
$ hg unshelve |
| 1541 |
unshelving change 'default-01' |
| 1542 |
$ cat 'my filename ' |
| 1543 |
hi |
| 1544 |
$ hg update -q --clean . |
| 1545 |
$ hg patch -p1 test_patch.patch |
| 1546 |
applying test_patch.patch |
| 1547 |
|
| 1548 |
$ hg strip -q -r . |
| 1549 |
#endif |
| 1550 |
|
| 1551 |
Check the comment of the last commit for consistency |
| 1552 |
|
| 1553 |
$ hg log -r . --template '{desc}\n' |
| 1554 |
add C to bars |
| 1555 |
|
| 1556 |
-- if phasebased, shelve works without patch and bundle |
| 1557 |
|
| 1558 |
$ hg update -q --clean . |
| 1559 |
$ rm -r .hg/shelve* |
| 1560 |
$ echo import antigravity >> somefile.py |
| 1561 |
$ hg add somefile.py |
| 1562 |
$ hg shelve -q |
| 1563 |
#if phasebased |
| 1564 |
$ rm .hg/shelved/default.hg |
| 1565 |
$ rm .hg/shelved/default.patch |
| 1566 |
#endif |
| 1567 |
|
| 1568 |
shelve --list --patch should work even with no patch file. |
| 1569 |
|
| 1570 |
$ hg shelve --list --patch |
| 1571 |
default (*s ago) * changes to: add C to bars (glob) |
| 1572 |
|
| 1573 |
diff --git a/somefile.py b/somefile.py |
| 1574 |
new file mode 100644 |
| 1575 |
--- /dev/null |
| 1576 |
+++ b/somefile.py |
| 1577 |
@@ -0,0 +1,1 @@ |
| 1578 |
+import antigravity |
| 1579 |
|
| 1580 |
$ hg unshelve |
| 1581 |
unshelving change 'default' |
| 1582 |
|
| 1583 |
#if phasebased |
| 1584 |
$ ls .hg/shelve-backup |
| 1585 |
default.shelve |
| 1586 |
#endif |
| 1587 |
|
| 1588 |
#if stripbased |
| 1589 |
$ ls .hg/shelve-backup |
| 1590 |
default.hg |
| 1591 |
default.patch |
| 1592 |
default.shelve |
| 1593 |
#endif |
| 1594 |
|
| 1595 |
|
| 1596 |
-- allow for phase-based shelves to be disabled |
| 1597 |
|
| 1598 |
$ hg update -q --clean . |
| 1599 |
$ hg strip -q --hidden -r 0 |
| 1600 |
$ rm -r .hg/shelve* |
| 1601 |
|
| 1602 |
#if phasebased |
| 1603 |
$ cp $HGRCPATH $TESTTMP/hgrc-saved |
| 1604 |
$ cat <<EOF >> $HGRCPATH |
| 1605 |
> [shelve] |
| 1606 |
> store = strip |
| 1607 |
> EOF |
| 1608 |
#endif |
| 1609 |
|
| 1610 |
$ echo import this >> somefile.py |
| 1611 |
$ hg add somefile.py |
| 1612 |
$ hg shelve -q |
| 1613 |
$ hg log --hidden |
| 1614 |
$ ls .hg/shelved |
| 1615 |
default.hg |
| 1616 |
default.patch |
| 1617 |
default.shelve |
| 1618 |
$ hg unshelve -q |
| 1619 |
|
| 1620 |
Override the disabling, re-enabling phase-based shelves |
| 1621 |
|
| 1622 |
$ hg shelve --config shelve.store=internal -q |
| 1623 |
|
| 1624 |
#if phasebased |
| 1625 |
$ hg log --hidden --template '{user}\n' |
| 1626 |
shelve@localhost |
| 1627 |
#endif |
| 1628 |
|
| 1629 |
#if stripbased |
| 1630 |
$ hg log --hidden --template '{user}\n' |
| 1631 |
#endif |
| 1632 |
|
| 1633 |
clean up |
| 1634 |
|
| 1635 |
#if phasebased |
| 1636 |
$ mv $TESTTMP/hgrc-saved $HGRCPATH |
| 1637 |
#endif |
| 1638 |
|
| 1639 |
changed files should be reachable in all shelves |
| 1640 |
|
| 1641 |
create an extension that emits changed files |
| 1642 |
|
| 1643 |
$ cat > shelve-changed-files.py << EOF |
| 1644 |
> """Command to emit changed files for a shelf""" |
| 1645 |
> |
| 1646 |
> from mercurial import registrar, shelve |
| 1647 |
> |
| 1648 |
> cmdtable = {} |
| 1649 |
> command = registrar.command(cmdtable) |
| 1650 |
> |
| 1651 |
> |
| 1652 |
> @command(b'shelve-changed-files') |
| 1653 |
> def shelve_changed_files(ui, repo, name): |
| 1654 |
> shelf = shelve.ShelfDir(repo).get(name) |
| 1655 |
> for file in shelf.changed_files(ui, repo): |
| 1656 |
> ui.write(file + b'\n') |
| 1657 |
> EOF |
| 1658 |
|
| 1659 |
$ hg --config extensions.shelve-changed-files=shelve-changed-files.py shelve-changed-files default |
| 1660 |
somefile.py |