usethis icon indicating copy to clipboard operation
usethis copied to clipboard

Could `pr_resume()` also work off PR numbers?

Open DavisVaughan opened this issue 3 years ago • 8 comments

pr_resume() currently works off a branch name, with the intention being that you might be coming back to a branch that you only have locally and don't have a PR for yet.

But when I have multiple PRs "in flight", I often find myself in this situation:

  • pr_push() to open a PR
  • pr_pause() and let Hadley review while i work on other pull requests
  • Once he has reviewed, go back and read the review (i.e. I'm looking at the pr number on the screen at this point)
  • pr_resume(<branch-name>) to incorporate changes
  • Commit and push changes
  • Merge on GitHub
  • pr_finish() or pr_finish(<pr-number>) to finish up

GitHub doesn't make the branch name particularly easy to copy/paste, the PR number is often easier, so it might be nice if pr_resume() could use the number instead

(i.e. there is a button to copy the branch name when you are in the PR window on GitHub, but it is copied as DavisVaughan:fix/cur-group-zero-row-gdf with the user name prefixed on the branch name, and usethis doesn't know what to do with that)

DavisVaughan avatar Aug 19 '22 17:08 DavisVaughan

Have you tried the interactive workflow by using pr_resume() without any arguments?

malcolmbarrett avatar Aug 19 '22 17:08 malcolmbarrett

I don't use that much. It seems like a reasonable option - except for the fact that it takes 15-20 seconds on a big repo like dplyr where there have been a ton of issues/prs

DavisVaughan avatar Aug 19 '22 17:08 DavisVaughan

I use that workflow a lot, and it's great in most circumstances, but it does sound frustrating on a big repo.

In similar functions for internal tooling, I've used the numbers approach, so I support that, too

malcolmbarrett avatar Aug 19 '22 17:08 malcolmbarrett

FWIW you can just use pr_fetch(123) instead.

That said, I never use pr_pause(). I always use pr_finish() because then I don't have to remember if I need to delete the local branch, and functionally it seems no slower than pr_pause()/pr_resume().

hadley avatar Aug 29 '22 21:08 hadley

Maybe we should unify pr_fetch() and pr_resume() since they only really differ in whether you supply a numeric PR number or a string branch name.

hadley avatar Sep 15 '22 20:09 hadley

Oh pr_fetch(123) does seem to do what I want. I was not aware that if I used pr_pause() (and kept the local branch around) that I could follow up with pr_fetch(123) or pr_resume("name") and both essentially do the same thing, assuming I have opened the PR.

I guess I was under the impression that pr_fetch(123) was going to yell at me and say something like "you already have this PR locally"


I can see the need to keep both pr_fetch() and pr_resume(), because pr_resume() doesn't require you to actually open the PR on github, you just need to have a local branch.

DavisVaughan avatar Sep 16 '22 13:09 DavisVaughan

I can see the need to keep both pr_fetch() and pr_resume(), because pr_resume() doesn't require you to actually open the PR on github, you just need to have a local branch.

Yeah I definitely use this fact (that there's no requirement there even be a PR (yet?)). Basically it gives you a branch chooser right in the R console.

jennybc avatar Sep 16 '22 13:09 jennybc

I'm somewhat convinced this is just a (potential) documentation issue. Like, could the docs for pr_fetch() maybe mention something about what happens when you call it and you already have the branch checked out locally?

DavisVaughan avatar Sep 16 '22 13:09 DavisVaughan