Skip to contents

This function will create a new version of the data directories, by copying the current data directories to a new directory in versions, and creating links to the new directories. The new version will be called version_name.

Usage

version_add(
  path = ".",
  intermediate_new_version = NULL,
  raw_new_version = NULL,
  intermediate_source = NULL,
  raw_source = NULL,
  intermediate_description = NULL,
  raw_description = NULL,
  git_branch = NULL,
  push = TRUE,
  quiet = FALSE
)

Arguments

path

Deprecated, and ignored: version_add() works on the repository of the working directory, like the other versioning functions. It will be removed, so that the name of the new version can come first.

intermediate_new_version

The name of the new version for the intermediate data

raw_new_version

The name of the new version for the raw data. If NULL, the raw data will be kept in the currently used version

intermediate_source

The name of the intermediate version to copy from. If NULL, it will be the current version

raw_source

The name of the raw version to copy from. If NULL, it will be the current version. Ignored if raw_new_version is NULL.

intermediate_description

A description of the new intermediate version

raw_description

A description of the new raw version, required if raw_new_version is given. Ignored if raw_new_version is NULL.

git_branch

The name of the git branch to create. If NULL, it will be the same as intermediate_new_version

push

If TRUE (the default), push the new branch to the origin remote, if there is one. If FALSE, the version is created locally only, and no git credentials are needed.

quiet

If TRUE, suppress messages

Value

TRUE if the version was successfully added

Details

intermediate_new_version and raw_new_version will be sanitised to remove spaces and other characters that are not allowed in directory names. If the sanitised version is different from the original version, a warning will be issued. Names starting with ., file-system reserved names, and the metadata file names raw_in_use and intermediate_in_use are refused. The new versions must not exist already in versions or data/version_meta.

The data are copied first; then the git branch is created, the links are updated and the meta files committed; the branch is pushed last. If any step before the push fails (or is interrupted), version_add() undoes what it did: it returns to the branch it started from, deletes the new branch, and removes the new version directories and meta files; the original error is kept, and anything that could not be undone is listed in a warning. It must be run on a branch (not on a detached HEAD). If the push fails, the version is kept, with a warning, and the branch can be pushed later.

Each version is described in data/version_meta/<version>.meta. If the raw and intermediate versions have the same name, that file has one row for each.