Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update repoHistory #146

Merged
merged 3 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.9007
Version: 3.9.1.9008
Authors@R:
c(
person(given = "Eric", family = "Anderson", email = "andersone@metrumrg.com", role = c("aut")),
Expand Down
18 changes: 17 additions & 1 deletion R/repoHistory.R
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ repoHistory <- function() {
stop("svn log failed")
}

dplyr::bind_rows(svn_log_v) %>%
svn_log_df <-
dplyr::bind_rows(svn_log_v) %>%
tidyr::unnest(paths) %>%
dplyr::filter(names(paths) == "text") %>%
tidyr::unnest(paths) %>%
Expand All @@ -31,4 +32,19 @@ repoHistory <- function() {
rev = as.integer(rev)
)

# Adjust file paths for cases of nested projects

# Find the common prefix among paths
common_prefix <- fs::path_common(svn_log_df$file)

# Remove the common prefix from paths
normalized_paths <- fs::path_rel(svn_log_df$file, start = common_prefix)

# Convert to absolute paths relative to logRoot
abs_paths <- fs::path_abs(normalized_paths, start = logRoot())

# Compute relative paths with respect to logRoot
svn_log_df$file <- as.character(fs::path_rel(abs_paths, start = logRoot()))

svn_log_df
}