git_prov: Access git provenance information

Description Usage Arguments Examples

Description

This function takes a filename and reads its git log, strips to its most recent commit, and appends it to the provenance tracking dataframe. If a prov log exists (and nolog is FALSE), this information is added to the log.

Usage

1
2
3
git_prov(filename, filetype = c("input", "output", "parent_script",
  "sourced_script", "plot")[1], nogit = FALSE, nolog = FALSE,
  not_tracked = FALSE)

Arguments

filename

A valid file name (relative or absolute) or vector of file names

filetype

The role of this file within this context: 'input', 'output', 'parent_script', 'sourced_script', or 'plot'. Defaults to 'input'.

nogit

Should this file be skipped for git provenance purposes? Defaults to FALSE.

nolog

Should this git provenance information be omitted from the log file? Defaults to FALSE.

not_tracked

Files used in a script but not tracked in Git can be identified by a non-response from a git log command; however, for files known to be not tracked in this repo (e.g. on a remote server or in a different repository) it may be desirable to simply skip the git log and mark it right away as not tracked, while still including it in the prov log and workflow, etc. Defaults to FALSE.

Examples

1
2
3
4
5
6
7
git_prov('raw_data.csv', filetype = 'input')
git_prov('raw_data.csv', filetype = 'input', nogit = TRUE)
  ### will skip provenance tracking for this file
git_prov('raw_data.csv', filetype = 'input', nolog = TRUE)
  ### will gather git commit info for this file, but will not add to the
  ### git tracking data frame.  This can be useful if you just want to
  ### peek at the commit info.

oharac/provRmd documentation built on June 25, 2019, 9:06 p.m.