-
Notifications
You must be signed in to change notification settings - Fork 286
[Bug] Remote branch not deleted by usethis::pr_finish() #1150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
What version of usethis do you have? If it's not a very recent dev version, can you please install from GitHub and see if you still have the problem? If so, a more complete reprex is helpful, as it's very hard for functions like this to work with all possible initial states. I would need to see the situation faced by |
My workflow is:
Example:
Is |
So you are NOT using the dev version of usethis. Quoting from above:
You asked "Is |
I'm not sure how to identify other branches that are associated with that remote. I just created the dummy remote for the purpose of this reprex, so it seems unlikely that anything else should be associated with it. I will try the dev version and let you know what I see! |
OK I see what this is about now. I am usually dealing with PRs as maintainer and/or as a participant in an internal PR. In the case of an internal PR, we typically delete the branch at the time we merge (or close) the PR. In the case of an external PR, I don't generally see that, from the PR contributor's POV, I can reproduce it. |
* Import gert * uses_git(), check_uses_git() * Add tests for uses_git(), check_uses_git() * Create gert_repo() to use like git_repo() during the switchover * git_config_get() --> git_cfg_get() * git_config_set() --> gert::git_config_set(), gert::git_config_global_set() * Take care this myself If it happens in gert, I can simplify things here. r-lib/gert#37 * Re-document() * Rename git.R to use_git.R * Kill git_config(), update use_git_config() * git2r::init() --> gert::git_init() * git2r::branch_delete() --> gert::git_branch_delete() * git2r::checkout() --> gert::git_branch_checkout() * git_branch_current(), git_branch(), git_branch_name() --> git_branch() * Deal with unborn branch edge case * Add test for git_branch() * Use git_repo() for the gert version and git2r_repo() for the legacy git2r version Move all the gert stuff back into git-utils.R * git_branch_create() --> git_branch_create_and_switch(), git2r::branch_create() --> gert::git_branch_create() * First, easy step towards being able to delete git_commit_find() * Install libgit2 for the macOS + r-devel build * git2r::branches() --> gert::git_branch_list() * Leave note to revisit this * Be more flexible re: finding remote for use_dev_package() * Use dev gert * git2r::status() --> gert::git_status() * gitr2::add(), commit() --> gert::git_add(), git_commit() * Switch over git_ask_commit() * Recover from file renaming that went sideways * Delete git_has_commits() No longer used anywhere * Whitespace * git_ask_commit() and friends; moving things * Add git_status(), no default for `untracked` * Remove default for `untracked` from `git_ask_commit()` * Intersect `paths` with status results in `git_ask_commit()` * Install libgit2 in the test run because dev gert means we must build from source * No immediate reason we would be installing magick from source * pkgdown run will also need dev gert and therefore libgit2 * Brain dump some notes * Remove `path = proj_get()` from from git helpers; prefer git_repo() over proj_get() Inspired by working on principles.md in 8c8dbdf Removing `path` as an arguement from internal git helpers where I think I should make implicit, hard-wired use of active project/repo Prefer git_repo() to proj_get() because of the implicit check for git-repo-hood. The only reason to use proj_get() in the git helpers is when when we helping to establish the active project as a git repo. Found a few places where I was neglecting to specify `repo = git_repo()` in gert calls. Although our preferred workflow will have user working in working directory that is (or is below) the active project, that is not an absolute requirement. * Continuing to implement ideas recently recorded in principles.md * Say what to do for noninteractive commit * git2r::remotes(), git2r::remote_url() --> gert::git_remote_list() * Better check for this argument * git2r::remote_*() --> gert::git_remote_*() * Inline logic from git_remote_find(), delete it * Delete git_remref() * Delete git_remote_exists() * Eliminate git2r from git_parse_remref() * Renaming github related files * More renaming * Remove interactivity that accomplishes very little If user is not happy with the repo_name or repo_desc, there's no easy remedy offered anyway. The defaults are quite good and both name and description can be modified later, so nothing is being written in stone here. * check_no_uncommitted_changes() is a more accurate name * Fix git_ask_commit() * Work on use_github() docs * Return invisibly * Use lifecycle * Switch use_github() over to gert * Update and run use_github() manual test * Tweak docs * Don't need to import deprecate_soft(), since I legit need to import deprecated() * Reminder to stay informed whether git_push() continues to automatically set tracking branch * Go back to original file names Now that the utils are in utils-git.R and utils-github.R, I see that it's better to NOT have a content-free `use_` prefix all over the place * Work on use_github() docs * Import glue::glue_data() * length() should be sum() * Introduce helpers that analyze the github remote setup * Chipping away ... * Error handling for bad GitHub config * Doc tweaks * Remotes need to know their own name * Work on format and print methods for github_config() * Fix wordo * That was unnecessary * Introduce ui_unset() * More work on presentations of GitHub remote config * Explicit args for git_push() The defaults are (or will be) what I need / want and yet it still seems wise to be explicit here. For robustness and also self-documentation. * Using dev roxygen2 * Line length * Beef up `desc` for GitHub remote configs we discourage * Swith use_github_links() over * Need to strip the `glue` class to make desc happy * Update manual test re: use_github() * Allow for the use of glue::glue() to produce `value` Also whitespace fix * Catch error from use_github_links() to avoid partial setup Fixes #1137 * Fix whitespace, linebreaks * Tidy up and trim down to one helper * Add `add = TRUE` to some on.exit()s * Rename create_github_token() (AGAIN); incorporate credentials::set_github_pat() Closes #1154 * Another place to alter advice re: storing GITHUB_PAT * Small improvements to use_github_links() * Whitespace / linebreaks * Why can't this be NULL? If it can't, I guess I'll find out. * Move this to a helper I can use elsewhere * Start to replace check_uses_github() * This needs to truly exit * Tweak whitespace/linebreaks * Account for a project that lacks a README * Switch over use_travis(), use_travis_badge() * Switch over appveyor functions * Re-document() * Switch over Circle CI functions * Extend get_github_primary() Re-conceive "is_fork" as "in_fork" Re-work config data for "fork_no_upstream" * Beef up `desc` for supported configs that can lead to errors These configs are untenable for specific functions, but not in general. * Retrospectively apply `in_fork` idea, don't claim primary is `upstream` * Switch over release functions * Fix test * Switch over github label functions * Switch over test coverage functions * Style, reflow roxygen comments * Update wordlist * `repo_spec` is guaranteed to exist * Add repo_spec argument to use_coverage() * Switch over github actions functions * Switch create_from_github() over * Remove use_git_credentials() * Remove this documented argument * Moving towards a new repo_spec helper * Housekeeping pass on GitHub Actions stuff * Update travis functions * Update appveyor functions * Groom non-GHA CI stuff Lots of uses_*() and check_uses_*() helpers are never called. I deleted them. I suspect they were added by PR contributors following what they saw for, e.g., travis. * Clean up coverage * Update github labels functions * Another helper to get primary repo spec; update use_tidy_thanks() * Update use_binder_badge() * Update release-related functions * Make it possible to exit github_remotes2() w/o hitting the API * Switch uses_github() over to github_remotes2() * Switch over project_data() * Update use_readme_[r]md() * Delete get_github_primary() * More touches to get_repo_spec() and * '4.0' --> 'release' in GHA * More internal documentation * Install imagemagick in test coverage workflow This is needed whenever magick updates on CRAN and there's no binary * Fix mistakes left from previous refactoring * Introduce check_pr_readiness(), stop_unsupported_pr_config() * Work on `pr_*` docs * Add git_branch_upstream() * Refactor git_branch_compare() Can't quite eliminate git2r until I gert gets something like ahead_behind() * Refactor check_branch_pulled() Now we always assume we're dealing with the current local branch and there is the option to specify the remote branch. But if unspecified, we honor upstream tracking branch. * Switch over pr_init() * Introduce pr_resume() * Edit error message * Switch over `git_pull()` * Don't assume remote and local branch have same name * Message when we delegate to pr_resume() * Create pr_pull_from_primary() * Better message when we can't pull * Messages * Stop passing credentials to git_pull() * Working on git push/pull and tracking branch * Progress on pr_fetch() * Tweak message * More work on pr_fetch() * Delete git_branch_remote() * git_push() and pr_push() * Delete git_branch_track() * Make pr_finish() at least pass R CMD check * Re-document() * Delete git_commit_find() * Delete git_branch_tracking() and git_branch_tracking_FIXME() * Update WORDLIST * Update pr_create_gh() * Notes and tweaks * Reclaim git_branch_tracking() * Rename this to pr_pull_primary_default() Meant to evoke: git pull upstream master But where we generalize: upstream --> primary master --> default (aspirational) * Switch over pr_finish() * Fix URL * Nonexistent tracking branch is NA, not NULL * Fill in URL * Whitespace * Make R-devel happy re: Rd links * Remove git2r * Preferred vocabulary * Tweak manual test * Work on pr_url() * Work on pr_pull_upstream() * Add a fetch to pr_fetch() * Define `branch` * Set remote tracking branch * Fix the refspec * Remove a usage of git_pull_upstream() * Revert a previous change, now that roxygen2 7.1.1 does the link the way R-devel wants * Comments and docs tweaks * Set upstream tracking here * Account for the glue class Glue vs not clue makes `identical()` fail, when it should not * Re-document() * Continue to clear my head about various git pulls * Working on PR docs * Remove the `owner` argument of `pr_fetch()` * No longer seems weird to me * Be consistent with style elsewhere * No need to incur all the overhead and extra verbiage of pr_pull() * Use an object that actually exists * Redundant with the messaging from git_pull() * Guard again the NA Can't use `identical()` because of glue class * This is only meaningful for external PRs `maintainer_can_modify` is `FALSE` for internal PRs, but maintainers can push into the branch, by definition * Inline all git pushes * Rename: pr_pull_upstream() --> pr_merge_main() * Use the right remote * Deal with docs * More re: the rename * NEWS updates * Delete github_owner_upstream() * Update pkgdown functions and docs * WIP Delete github_owner(), github_repo() * Deleting more old helpers * Delete github_repo_spec() * Stop tracking this * Refactor browse.R * Update WORDLIST * Better comment * Refactor GitHub URL parsing * Complete the switch over of github_remotes() * Rework old uses_github(), check_uses_github() * Not used anywhere * This check is really specific to PRs * Say less I either need to say less or also cover branch switching via RStudio or gert. * Fixes bugs revealed by manual testing of pr_push() * Delete the remote branch in pr_finish() Closes #1150 * Add NEWS bullet * Work on NEWS * Update principles.md * Use the new gert::git_remote_set_url() * Share auth docs between use_github() and create_from_github() * Work on deprecations * Docs for create_github_token() * Update wordlist * Refactor github token helpers Closes #1133 "Error message from github_user() is concealed". Any uncaught error is now revealed in the error we throw. We also challenge "accidental non-forks" in interactive sessions, i.e. when someone uses `create_from_github()` on a repo they can't push to, without a GitHub PAT. We used to silently just clone, which lead to lots of pain at tidyverse dev days, when people did not complete the setup, but hoped to make a PR. * Better, earlier error when no PAT available * Whitespace * check_github_token() no longer returns the token Stop using its return value as a PAT * Update manual tests * Add TODO * Update manual tests * Unbork use_git_remote() It is VERY important to use gert::git_remote_add() to set up a new remote, as opposed to get_remote_set_url(). The latter appears to work, but it does not fully set up the remote. In particular the fetch refspec is not configured, so operations like setting upstream tracking branch and merging fail with very mysterious errors. * More edits to manual tests * Don't run this example * Bump gert version This was an artificial version number for totally unrelated reasons, but I want people to have the "latest". So this needs to at least reflect the highest version number there is. * Re-document() * Groom this file * Bring the internal github helpers back under one roof * Fix cfg_upstream_only(); add test Part of #1175 * Fix cfg_upstream_but_origin_is_not_fork(); add tests Closes #1175 * The next version will be 2.0.0 * Offer to abort a conflicted merge Closes #1168
When using
usethis::pr_finish()
, my local branch is deleted, but not the remote branch.I wonder if there is a bug where the
==
should be>
here:https://github.com/r-lib/usethis/blob/master/R/pr.R#L350
I don't get the expected output from
ui_done()
, and the branch is not deleted from GitHubThe text was updated successfully, but these errors were encountered: