determine_ref | R Documentation |
Return the git ref (tag or branch) of the repo to install given the available branches and tags.
determine_ref(ref, available_refs, fallback_branch = "main", branch_sep = "@")
ref |
ref we want to build |
available_refs |
data.frame with columns |
fallback_branch |
the default branch to try to use if no other matches found |
branch_sep |
separator between branches in |
A ref is either a tag or branches separated by slashes of the form name1@name2@...@nameN
.
Where separator is specified by branch_sep
argument
This function checks for an exact match for the tag if this is not found then
among the available branches, it searches in the order
name1@name2@...@nameN
, name2@name3@...@nameN
, name3@name4@...@nameN
, ..., nameN
branch/tag to choose to match feature, error if no suitable branch was provided with the type attribute "tag" or "branch"
determine_ref(
"feature1",
data.frame(ref = c("main", "feature1"), type = "branch")
) == structure("feature1", type = "branch")
determine_ref(
"feature1@devel",
data.frame(ref = c("main", "devel", "feature1"), type = "branch")
) == structure("devel", type = "branch")
determine_ref(
ref = "fix1@feature1@devel",
available_refs = data.frame(
ref = c(
"main", "devel", "feature1", "feature1@devel",
"fix1@feature1@devel", "fix1"
),
type = "branch"
)
) == structure("fix1@feature1@devel", type = "branch")
determine_ref(
"fix1@feature1@devel",
data.frame(
ref = c("main", "devel", "feature1", "feature1@devel", "fix1"),
type = "branch"
)
) == structure("feature1@devel", type = "branch")
determine_ref(
"fix1@feature1@devel",
data.frame(ref = c("main", "devel", "feature1", "fix1"), type = "branch")
) == structure("devel", type = "branch")
determine_ref("feature1@release", data.frame(ref = c("main", "devel"), type = "branch"))
# error because neither `feature1@release` nor `release` branch exists
# determine_ref("feature1@release", data.frame(ref = c("master", "devel"), type = "branch"))
# tag examples
determine_ref(
"v0.1",
data.frame(ref = c("main", "devel", "feature1", "v0.1"), type = c(rep("branch", 3), "tag"))
) == structure("v0.1", type = "tag")
determine_ref(
"v0.2",
data.frame(ref = c("main", "devel", "feature1", "v0.1"), type = c(rep("branch", 3), "tag"))
) == structure("main", type = "branch")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.