This vignette provides detailed documentation and usage examples for
the three diff functions in the qctools package:
diffPreviousVersions(), diffQced(), and
diffOriginal(). These functions facilitate the visual
comparison of different versions of files within your project, aiding in
quality control and code review processes.
gitLog(): Retrieves commit history for
a filediffPreviousVersions(): Compares two
versions of a filediffQced(): Compares latest version
with the most recent QCed versiondiffOriginal(): Compares latest
version with the original versiongitLog()
The gitLog() function returns the commit hash, last
author and datetime of all commits for a specified file. The commit
history is useful for comparing different versions of a file.
gitLog("script/data-assembly.R")Output:
| file | last_commit | last_author | last_datetime |
|---|---|---|---|
| script/data-assembly.R | eb96eeb | Alice Johnson | 2024-11-21 15:45:00 |
| script/data-assembly.R | 6f05a8b | John Smith | 2024-11-20 12:30:00 |
| script/data-assembly.R | c4f837e | Jane Doe | 2024-11-19 10:00:00 |
gitLog("script/data-assembly.R", last_rev_only = TRUE)Output:
| file | last_commit | last_author | last_datetime |
|---|---|---|---|
| script/data-assembly.R | eb96eeb | Alice Johnson | 2024-11-21 15:45:00 |
diffPreviousVersions()
The diffPreviousVersions() function visually identifies
changes between two versions of a file, highlighting additions,
deletions, and modifications.
diffPreviousVersions(
file = "script/data-assembly.R",
previous_version = "6f05a8b",
side_by_side = FALSE
)Output:

diffPreviousVersions():
green text indicates
modified code, red text
indicates deleted code.diffQced()
The diffQced() function identifies differences from the
latest version of a file with the most recent QCed (quality-controlled)
version, visually highlighting any changes that need re-evaluation.
diffOriginal()
The diffOriginal() function identifies differences from
the latest version of a file with the original (e.g. template) version,
visually highlighting any changes.