-
Notifications
You must be signed in to change notification settings - Fork 761
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
Clean up install_github parameters pull and branch #509
Conversation
I'd prefer to use some simple S3 dispatch. |
Do you mean something like this:
? |
Yes, exactly, except I'd write the last bit as |
- New exported function github_pull() to be used as value for ref parameter - Implemented using a simple S3 dispatch mechanism - Tests with improved mocking - new function with_mock - Tests for warning when using deprecated parameters branch and pull
This implementation seems to work for me. |
@@ -69,26 +67,18 @@ github_get_conn <- function(repo, username = getOption("github.user"), | |||
ref <- branch | |||
} | |||
|
|||
if (!is.null(pull)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this always be false?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not if an explicit pull = xxx
is passed to install_github
-- it will be captured by ...
and assigned to pull
in the call to install_github_single
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see - missed the separation of the functions in the diff.
Should be okay now. |
Clean up install_github parameters pull and branch
Thanks! |
The
ref
andpull
parameters are mutually exclusive, and thebranch
parameter has been deprecated. The latter two should be removed, and theref
parameter should now also accept functions.If
ref
is a function, it will be called with a named list that contains all other parameters (after parsing withgithub_parse_path
and obtaining access tokens), and return an updated version of this list. Implementation and usage examples:This would allow for a cleaner implementation of #350.
Usage of the deprecated parameters
pull
andbranch
can be detected by looking at...
.Thoughts?