Skip to content

But CLI: Use modern apply for top-level but apply#13321

Merged
krlvi merged 1 commit intomasterfrom
modernize-apply
Apr 15, 2026
Merged

But CLI: Use modern apply for top-level but apply#13321
krlvi merged 1 commit intomasterfrom
modernize-apply

Conversation

@krlvi
Copy link
Copy Markdown
Member

@krlvi krlvi commented Apr 15, 2026

Summary

  • route top-level but apply through command::branch::apply
  • make the modern apply command available in legacy builds while preserving shell output
  • remove the unused legacy apply implementation and module export

Verification

  • cargo test -p but apply
  • cargo fmt --check --all
  • cargo clippy -p but --all-targets

Copilot AI review requested due to automatic review settings April 15, 2026 11:42
@github-actions github-actions bot added rust Pull requests that update Rust code CLI The command-line program `but` labels Apr 15, 2026
@krlvi krlvi force-pushed the modernize-apply branch from 2472d7f to 5a84e69 Compare April 15, 2026 11:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 apply to call command::branch::apply (modern implementation).
  • Make the modern apply implementation available under feature = "legacy" by removing legacy-only gating in command::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).

Copy link
Copy Markdown
Contributor

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread crates/but/src/lib.rs
out,
)?;
command::legacy::branch::apply::apply(&mut ctx, &branch_name, out)
command::branch::apply(ctx, &branch_name, out)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

@krlvi krlvi changed the title Use modern apply for top-level but apply But CLI: Use modern apply for top-level but apply Apr 15, 2026
@estib-vega
Copy link
Copy Markdown
Contributor

image

@krlvi krlvi force-pushed the modernize-apply branch 3 times, most recently from 0689a0d to 8d4fa2b Compare April 15, 2026 12:31
@krlvi krlvi force-pushed the modernize-apply branch from 8d4fa2b to 962422b Compare April 15, 2026 12:36
@krlvi krlvi enabled auto-merge April 15, 2026 12:47
@krlvi krlvi merged commit de7e063 into master Apr 15, 2026
41 checks passed
@krlvi krlvi deleted the modernize-apply branch April 15, 2026 12:55
@slarse
Copy link
Copy Markdown
Contributor

slarse commented Apr 16, 2026

Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLI The command-line program `but` rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants