Commit 2f428cb
committed
load(feat[append-multi]): Coalesce multi-file --append into one session
why: ``tmuxp load f1 f2 f3 --append`` previously failed on the second
file because each file was loaded against its own config's
``session_name``, and the second file's ``new_session`` would collide
with the session the first file just created. Multi-file ``--append``
should land every workspace in a single shared target session.
The fix has two parts because the old behavior was wrong on two layers:
1. Pre-resolve the target session name once, before the load loop.
``--new-session-name`` wins; otherwise fall back to the first
workspace file's ``session_name`` config key. Apply the resolved
name to every iteration's ``new_session_name`` so all loads target
the same session.
2. Make ``_dispatch_build`` honor ``append`` even when the target
session already exists in detached mode. Previously the ``if
detached:`` branch unconditionally called ``builder.build()`` (no
append arg), which re-tried session creation and raised
``TmuxSessionExists``. New hoisted check: when ``append=True`` and
the named session already exists, build windows directly onto the
existing session via ``builder.build(existing, append=True)``,
honoring ``detached`` for whether to attach afterwards.
what:
- src/tmuxp/cli/load.py: pre-resolve append_target_session_name in
command_load when args.append and len(workspace_files) > 1; force
every loop iteration to use it as new_session_name.
- src/tmuxp/cli/load.py: add session_name kwarg to _dispatch_build;
hoist an append-to-existing-session branch above the detached/
attached split so detached + append + session-exists is honored.
- tests/cli/test_load.py: two functional tests covering
(a) ``load f1 f2 --append`` coalescing into f1's session_name, and
(b) ``--new-session-name`` overriding the first file's session_name.
Re-ports PR #839 (originally a single 2022 WIP commit). Drops the
WIP's broken in-loop scoping of original_session_name and its type
mismatch between ConfigReader._from_file (returns dict) and
new_session_name (str).1 parent 6edda37 commit 2f428cb
2 files changed
Lines changed: 162 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
328 | 328 | | |
329 | 329 | | |
330 | 330 | | |
| 331 | + | |
331 | 332 | | |
332 | 333 | | |
333 | 334 | | |
| |||
367 | 368 | | |
368 | 369 | | |
369 | 370 | | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
370 | 391 | | |
371 | 392 | | |
372 | 393 | | |
| |||
618 | 639 | | |
619 | 640 | | |
620 | 641 | | |
| 642 | + | |
621 | 643 | | |
622 | 644 | | |
623 | 645 | | |
| |||
696 | 718 | | |
697 | 719 | | |
698 | 720 | | |
| 721 | + | |
699 | 722 | | |
700 | 723 | | |
701 | 724 | | |
| |||
877 | 900 | | |
878 | 901 | | |
879 | 902 | | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
| 920 | + | |
| 921 | + | |
| 922 | + | |
| 923 | + | |
| 924 | + | |
| 925 | + | |
| 926 | + | |
| 927 | + | |
| 928 | + | |
| 929 | + | |
880 | 930 | | |
881 | 931 | | |
882 | 932 | | |
| |||
890 | 940 | | |
891 | 941 | | |
892 | 942 | | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
893 | 946 | | |
894 | 947 | | |
895 | 948 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
356 | 356 | | |
357 | 357 | | |
358 | 358 | | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
| 418 | + | |
| 419 | + | |
| 420 | + | |
| 421 | + | |
| 422 | + | |
| 423 | + | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
| 430 | + | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
359 | 468 | | |
360 | 469 | | |
361 | 470 | | |
| |||
0 commit comments