Skip to content

Conversation

@schacon
Copy link
Member

@schacon schacon commented Oct 17, 2025

This improves but push to show urls you can follow up with, also not explode if you try to push to gerrit with no changes.

Here is GH:

❯ but push yv
Pushing branch 'canonicalize-askpass-call'...
Push completed successfully
Pushed to remote: origin
  canonicalize-askpass-call -> refs/remotes/origin/canonicalize-askpass-call

Branch URL: https://github.com/gitbutlerapp/gitbutler/tree/canonicalize-askpass-call

Here is gerrit now, it will show a url per commit on that branch:

❯ but push j7
Pushing branch 'sc-but-version'...
Push completed successfully
Pushed to remote: origin

Gerrit reviews:
  4bd7f7c: http://192.168.178.83:8080/c/testing/+/41
  62720f4: http://192.168.178.83:8080/c/testing/+/32

Enhance push output to display a link to the pushed branch or Gerrit change so users can quickly view their changes on the remote. Added URL generation helpers for GitHub, GitLab and Gerrit (parsing multiple remote URL forms), a wrapper to pick the right URL, and logic to lookup the project's remote URL and print a Branch URL or View changes link after a successful push. Also included a dbg! call for the push result and minor output formatting adjustments.
Show branch and commit web links in the but log output when a remote is available, including Gerrit-aware URLs. This adds URL generation helpers (crates/but/src/url_utils.rs), wires remote/gerrit detection into the log output, and prints per-branch and per-commit URLs (GitHub/GitLab/Gerrit) in the commit graph. It also reuses the new url_utils in push output and cleans up removed duplicate URL helper code from push/mod.rs.
When pushing to Gerrit the post-push dialog sometimes created a review URL but did not display it; additionally push failures printed large, unhelpful error dumps. Add logic to always attempt to display a branch/review URL (when it can be generated) and extract a concise, user-friendly error message from known git/Gerrit error patterns so failures are shown succinctly while still showing the URL when available.

Changes:
- Add show_branch_url() to generate and print a branch or Gerrit "View changes" URL.
- Add extract_push_error_message() to parse common push errors ("no new changes", "remote rejected", "failed to push some refs", permission/network errors) and return a short explanation.
- Replace the previous direct push result handling with match handling: on Ok, print push details and URL; on Err, print the extracted short error message, still show the URL if available, and return the error.

This improves UX by surfacing useful URLs even on failures and by providing readable, actionable error messages instead of large debug dumps.
For Gerrit remotes we now display per-commit Gerrit review URLs (matching how `but status` shows Gerrit URLs) for the commits on the branch that was just pushed. If no individual review URLs are present we fall back to a dashboard/branch URL. For non-Gerrit remotes the existing branch URL logic is preserved. Added helper functions to fetch stack/branch details, format and colorize commit IDs, and improved Gerrit SSH host parsing in URL utilities. Also handle errors when showing URLs without failing the push output.
@vercel
Copy link

vercel bot commented Oct 17, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Preview Comments Updated (UTC)
gitbutler-web Ignored Ignored Preview Oct 17, 2025 1:48pm

@github-actions github-actions bot added the rust Pull requests that update Rust code label Oct 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rust Pull requests that update Rust code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant