Skip to content

Commit e507b02

Browse files
committed
i sailuh#302 Adds time parameter to git CLI
In evolutionary analyses, users can generate time windows either based on the author timestamp or the committer timestamp. Adds an option to choose the desired timestamp. Also removes the filtering options from the tabulation CLI, as we are interested in the entire git log here. Signed-off-by: Nicole Hoess <[email protected]>
1 parent 1d440f1 commit e507b02

File tree

3 files changed

+8
-14
lines changed

3 files changed

+8
-14
lines changed

conf/kaiaulu_analysis.yml

-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,6 @@ filter:
8484
remove_filepaths_containing:
8585
- test
8686

87-
8887
# Third Party Tools Configuration #
8988
#
9089
# See Kaiaulu's README.md for details on how to setup these tools.

conf/kaiaulu_cli.yml

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929

3030
# Options for the git CLI.
3131
git:
32+
# You can choose to split the git log by either author or committer
33+
# time.
34+
time: committer_datetimetz
3235
identity:
3336
# Should identities be matched when parsing the gitlog?
3437
match: TRUE

exec/git.R

+5-13
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,8 @@ if(arguments[["tabulate"]] & arguments[["help"]]){
6565
perceval_path <- path.expand(tool[["perceval"]])
6666
git_repo_path <- path.expand(conf[["version_control"]][["log"]])
6767

68-
file_extensions <- conf[["filter"]][["keep_filepaths_ending_with"]]
69-
substring_filepath <- conf[["filter"]][["remove_filepaths_containing"]]
70-
filter_commit_size <- conf[["filter"]][["remove_filepaths_on_commit_size_greather_than"]]
71-
7268
project_git <- parse_gitlog(perceval_path,git_repo_path)
7369

74-
# Filter files
75-
if (length(file_extensions) > 0) project_git <- project_git %>% filter_by_file_extension(file_extensions,"file_pathname")
76-
if (length(substring_filepath) > 0) project_git <- project_git %>% filter_by_filepath_substring(substring_filepath,"file_pathname")
77-
if (length(filter_commit_size) > 0) project_git <- project_git %>% filter_by_commit_size(commit_size = filter_commit_size)
78-
7970
# Identity match
8071
if (id_match){
8172
project_log <- list(project_git=project_git)
@@ -109,6 +100,7 @@ if(arguments[["tabulate"]] & arguments[["help"]]){
109100
conf <- yaml::read_yaml(conf_path)
110101
cli <- yaml::read_yaml(cli_path)
111102

103+
time <- cli[["git"]][["time"]]
112104
id_match <- cli[["git"]][["identity"]][["match"]]
113105
id_names_only <- cli[["git"]][["identity"]][["names_only"]]
114106

@@ -144,8 +136,8 @@ if(arguments[["tabulate"]] & arguments[["help"]]){
144136
format = "%a %b %d %H:%M:%S %Y %z", tz = "UTC")
145137

146138
# The start and end dates correspond to the date of the earliest and latest commit, respectively.
147-
start_date <- min(project_git$author_datetimetz,na.rm=TRUE)
148-
end_date <- max(project_git$author_datetimetz,na.rm=TRUE)
139+
start_date <- min(project_git[[time]],na.rm=TRUE)
140+
end_date <- max(project_git[[time]],na.rm=TRUE)
149141

150142
# Create time windows
151143
if (length(ranges) > 0) {
@@ -204,8 +196,8 @@ if(arguments[["tabulate"]] & arguments[["help"]]){
204196
entity_save_path = file.path(entity_save_dir, save_file_name)
205197

206198
# Obtain all commits from the gitlog which are within a particular window_size
207-
project_git_slice <- project_git[(project_git$author_datetimetz >= start_day) &
208-
(project_git$author_datetimetz <= end_day), ]
199+
project_git_slice <- project_git[(project_git[[time]] >= start_day) &
200+
(project_git[[time]] <= end_day), ]
209201

210202
# Perform entity analysis
211203
changed_entities <- setNames(data.table(matrix(nrow = 0, ncol = 7)),

0 commit comments

Comments
 (0)