hadley/devtools — pull request #509 by krlmlr (2014-06-26 23:48:34+00:00)
Title: Clean up install_github parameters pull and branch

The `ref` and `pull` parameters are mutually exclusive, and the `branch` parameter has been deprecated. The latter two should be removed, and the `ref` 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 with `github_parse_path` and obtaining access tokens), and return an updated version of this list. Implementation and usage examples:

```
github_pull_request <- function(pull) {
force(pull)
function(param) {
pullinfo <- github_pull_info(param$repo, param$username, param$pull)
param$username <- pullinfo$username
param$ref <- pullinfo$ref
param
}
}

install_github("devtools", ref = github_pull_request(475))

github_pull_request <- function(pull) {
force(pull)
function(param) {
pullinfo <- github_pull_info(param$repo, param$username, param$pull)
param$username <- pullinfo$username
param$ref <- pullinfo$ref
param
}
}

github_release <- function(pos = 1, pre_release = TRUE) {
force(pos)
force(pre_release)
function(param) {
param$ref <- ...
param
}
}

install_github("devtools", github_release())
```

This would allow for a cleaner implementation of #350.

Usage of the deprecated parameters `pull` and `branch` can be detected by looking at `...`.

Thoughts?