But CLI: Use modern apply for top-level but apply#13321
Conversation
There was a problem hiding this comment.
Pull request overview
This PR routes the legacy-only top-level but apply command through the modern command::branch::apply implementation, aligning behavior across builds while removing the now-redundant legacy apply code.
Changes:
- Switch legacy top-level
but applyto callcommand::branch::apply(modern implementation). - Make the modern apply implementation available under
feature = "legacy"by removing legacy-only gating incommand::branch. - Remove the unused legacy apply module and its export.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
crates/but/src/lib.rs |
Routes top-level legacy Subcommands::Apply through command::branch::apply using setup::init_ctx. |
crates/but/src/command/legacy/branch/mod.rs |
Removes the legacy apply module export. |
crates/but/src/command/legacy/branch/apply.rs |
Deletes the legacy apply implementation. |
crates/but/src/command/branch/mod.rs |
Exposes apply in legacy builds by removing cfg(not(feature = "legacy")) gating. |
crates/but/src/command/branch/apply.rs |
Adjusts shell output to emit the full reference name (matching legacy shell output expectations). |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2472d7fe21
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| out, | ||
| )?; | ||
| command::legacy::branch::apply::apply(&mut ctx, &branch_name, out) | ||
| command::branch::apply(ctx, &branch_name, out) |
There was a problem hiding this comment.
Preserve legacy branch-name resolution for top-level apply
In legacy builds, routing Subcommands::Apply through command::branch::apply drops the old command::legacy::branch::apply::resolve_reference_to_apply behavior, which handled non-exact inputs (for example resolving remote-only names and interactive/auto selection for partial matches). The new path relies on repo.find_reference(branch_name) exact resolution, so previously valid but apply <name> inputs now fail with “reference did not exist.” This is a compatibility regression in the legacy command path.
Useful? React with 👍 / 👎.
0689a0d to
8d4fa2b
Compare
|
Nice! |

Summary
but applythroughcommand::branch::applyVerification