Skip to content

Commit 7e5e5df

Browse files
committed
implement 'step_size' param
1 parent aadd485 commit 7e5e5df

File tree

4 files changed

+18
-4
lines changed

4 files changed

+18
-4
lines changed

DESCRIPTION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: githist
22
Title: Code analyses traced along the 'git' history of a package
3-
Version: 0.0.1.019
3+
Version: 0.0.1.020
44
Authors@R:
55
person("Mark", "Padgham", , "mark.padgham@email.com", role = c("aut", "cre"),
66
comment = c(ORCID = "0000-0003-2172-5265"))

R/githist-fn.R

+10-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@
33
#' @param path Path to local repository containing an R package.
44
#' @param n If given, only analyses the preceding 'n' commits in the git
55
#' history.
6+
#' @param step_size Analyse package for each `step_size` commits. For example,
7+
#' with `step_size = 2`, analyses will be run on every second commit, instead
8+
#' of default running on every commit. The value of `n` then analyses the
9+
#' first `n` entries taken at intervals of `step_size`.
10+
#'
611
#' @return A list of three items:
712
#' \itemize{
813
#' \item desc_data Containing data from `DESCRIPTION` files, along with data on
@@ -14,9 +19,10 @@
1419
#' }
1520
#'
1621
#' @export
17-
githist <- function (path, n = NULL) {
22+
githist <- function (path, n = NULL, step_size = 1L) {
1823
checkmate::assert_character (path, len = 1L)
1924
checkmate::assert_directory (path)
25+
checkmate::assert_int (step_size, lower = 1L)
2026
if (!is.null (n)) {
2127
checkmate::assert_int (n, lower = 1L)
2228
}
@@ -29,6 +35,9 @@ githist <- function (path, n = NULL) {
2935
}
3036

3137
h <- gert::git_log (repo = path_cp, max = 1e6)
38+
if (step_size > 1L) {
39+
h <- h [seq (1, nrow (h), by = step_size), ]
40+
}
3241
if (!is.null (n)) {
3342
h <- h [seq_len (n), ]
3443
}

codemeta.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"codeRepository": "https://github.com/ropensci-review-tools/githist",
99
"issueTracker": "https://github.com/ropensci-review-tools/githist/issues",
1010
"license": "https://spdx.org/licenses/GPL-3.0",
11-
"version": "0.0.1.019",
11+
"version": "0.0.1.020",
1212
"programmingLanguage": {
1313
"@type": "ComputerLanguage",
1414
"name": "R",

man/githist.Rd

+6-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)