git-utils: Convenience Git-related utility functions used by...

git-utilsR Documentation

Convenience Git-related utility functions used by updateBiocPackageRepoObjects()

Description

prepare_git_repo_for_work() and git_commit() are used internally by updateBiocPackageRepoObjects() to perform Git operations.

Usage

prepare_git_repo_for_work(repopath=".", branch=NULL, git=NULL,
                          use.https=FALSE)

git_commit(repopath=".", commit_msg, push=FALSE,
           git=NULL, user_name=NULL, user_email=NULL)

Arguments

repopath

The path (as a single string) to the local Git repository of a Bioconductor package.

If the specified path exists, prepare_git_repo_for_work() will check that it's a workable Git repo (i.e. contains no uncommitted changes). If that's the case then it will call git pull on it, otherwise it will return an error.

If the specified path does not exist, prepare_git_repo_for_work() will try to infer the package name from repopath and clone it from git.bioconductor.org.

branch

The branch (as a single string) of the Git repository to work on.

If NULL, then the current branch is used (if repopath already exists) or the default branch is used (if repopath does not exist and needs to be cloned).

git

The path (as a single string) to the git command if it's not in the PATH.

use.https

By default, git clone git@git.bioconductor.org:packages/MyPackage is used to clone a package repo from the Bioconductor Git server. Note that this works only for authorized maintainers of package MyPackage. By setting use.https to TRUE, the package will be cloned instead from https://git.bioconductor.org:packages/MyPackage, which should work for anybody, but then pushing back the changes to the package won't be possible.

commit_msg

The Git commit message.

push

Whether to push the changes or not. Changes are committed but not pushed by default. You need push access to the package Git repository at git.bioconductor.org in order to use push=TRUE.

user_name, user_email

Set the Git user name and/or email to use for the commit. This overrides the Git user name and/or email that the git command would otherwise use. See the COMMIT INFORMATION section in system2("git", c("commit", "--help")) for the details about where the git command normally takes this information from.

Value

prepare_git_repo_for_work() returns FALSE if the supplied path already exists, and TRUE if it didn't exist and needed to be cloned.

git_commit() returns an invisible NULL.

See Also

  • updateBiocPackageRepoObjects which uses prepare_git_repo_for_work and git_commit internally.

  • bump_pkg_version.

Examples

repopath <- file.path(tempdir(), "IdeoViz")

## We must use HTTPS access to clone the package because we are
## not maintainers of the IdeoViz package. A more realistic situation
## would be to use prepare_git_repo_for_work() on a package that we
## maintain, in which case 'use.https=TRUE' would not be needed:
prepare_git_repo_for_work(repopath, use.https=TRUE)

bump_pkg_version(repopath, update.Date=TRUE)

git_commit(repopath, commit_msg="version bump", push=FALSE)

unlink(repopath, recursive=TRUE)

Bioconductor/updateObject documentation built on Oct. 30, 2024, 12:15 p.m.