Skip to content

Commit

Permalink
Update function name
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelmcd18 committed Aug 2, 2024
1 parent 3f09fc3 commit 5606dd3
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 11 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: review
Title: QC Management and Helpers
Version: 3.9.1.9000
Version: 3.9.1.9001
Authors@R:
c(
person(given = "Eric", family = "Anderson", email = "andersone@metrumrg.com", role = c("aut")),
Expand Down
1 change: 1 addition & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export(logCreate)
export(logPending)
export(logSummary)
export(renderQCSummary)
export(repoHistory)
export(svnExport)
export(svnLog)
export(with_demoRepo)
Expand Down
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

- `diffFiles` can now display the entire file that is being diffed. (#115)

- Added `repoHistory` function to return history of all commits in the repository. (#116)

# review 3.9.1

## New features and changes
Expand Down
15 changes: 8 additions & 7 deletions R/getCommitHistory.R → R/repoHistory.R
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
#' Get Full Commit History
#' Get Repository History
#'
#' @description
#' Returns a data.frame containing every commit made to the repo.
#' The information recorded includes the author, revision, date and
#' commit message.
#'
#' @export
getCommitHistory <- function() {
repoHistory <- function() {

svn_all <- tryCatch(
svn_log_v <- tryCatch(
svnCommand("log", .flags = "-v"),
error = identity
)

if (inherits(svn_all, "error")) {
if (inherits(svn_log_v, "error")) {
stop("svn log failed")
}

dplyr::bind_rows(svn_all) %>%
dplyr::bind_rows(svn_log_v) %>%
tidyr::unnest(paths) %>%
dplyr::filter(names(paths) == "text") %>%
tidyr::unnest(paths) %>%
Expand All @@ -26,7 +26,8 @@ getCommitHistory <- function() {
file = paths
) %>%
dplyr::mutate(
date = as.Date(substr(date, 1, 10)),
file = sub('.', '', file))
date = as.Date(date),
file = sub('.', '', file) # Remove first character
)

}
3 changes: 2 additions & 1 deletion R/reviewPackage.R
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ globalVariables(
"n",
"commit",
"name",
"value"
"value",
"paths"
)
)
13 changes: 13 additions & 0 deletions man/repoHistory.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
create_test_svn()

df_history <- getCommitHistory()
df_history <- repoHistory()

test_that("getCommitHistory works as expected", {
test_that("repoHistory works as expected", {

expect_equal(nrow(df_history %>% dplyr::distinct(rev)), 8)

Expand Down

0 comments on commit 5606dd3

Please sign in to comment.