Skip to contents

sync_repos clones any packages missing from dest_dir and updates the ones already present. When a package's repository exists on GitHub under org (or username), it is cloned from there as the origin remote and the Bioconductor git server is added as the upstream remote. Otherwise, the package is cloned from the Bioconductor git server and that remote is named upstream. The local devel branch is then updated from upstream/devel and set to track set_upstream.

Usage

sync_repos(
  packages,
  dest_dir,
  username,
  org = username,
  set_upstream = "upstream/devel",
  restart_from = character(0L),
  BPPARAM = NULL
)

sync_repo(
  package,
  dest_dir,
  org = "Bioconductor",
  gh_exists = .repo_exists(pkg = package, org = org),
  set_upstream = "upstream/devel"
)

Arguments

packages

character() A vector of Bioconductor package names to clone or update.

dest_dir

character(1) The directory where the repositories are (or will be) located.

username

character(1) (optional) The GitHub username used in the query to check default packages

org

character(1) The organization for which to extract the names of the repositories on GitHub (default "Bioconductor").

set_upstream

character(1) The remote branch that the local devel branch will track, either "upstream/devel" (default) or "origin/devel". Packages without a GitHub repository always track "upstream/devel".

restart_from

character(1) The name of a package in packages from which to resume, e.g., after an interruption due to merge conflicts. Default character(0L).

BPPARAM

BiocParallelParam An optional BiocParallelParam instance defining the parallel back-end to be used during evaluation. Default NULL.

package

character(1) A single Bioconductor package name.

gh_exists

logical(1) Whether the repository exists on GitHub under org. By default, this is checked with the GitHub API.

Value

sync_repo: the path to the local repository, invisibly. sync_repos: a character vector of local repository paths, invisibly.

Details

Existing local repositories have their remotes corrected: origin is pointed at GitHub when the GitHub repository exists, and the Bioconductor upstream remote is added when missing. Merge conflicts stop the process; resolve them and resume with restart_from. Clones and fetches use the command-line git client with SSH connection and keep-alive timeouts, and are retried up to 3 times.

Examples

if (interactive()) {
    sync_repos(
        c("S4Vectors", "IRanges"), dest_dir = "~/bioc", org = "Bioconductor"
    )

    ## in parallel
    library(BiocParallel)
    sync_repos(
        c("S4Vectors", "IRanges"), dest_dir = "~/bioc",
        org = "Bioconductor", BPPARAM = MulticoreParam(workers = 4)
    )

    ## a single package
    sync_repo("S4Vectors", dest_dir = "~/bioc", org = "Bioconductor")
}