@@ -23,11 +23,11 @@ require(doSNOW,quietly=TRUE)
23
23
doc <- "
24
24
USAGE:
25
25
git.R tabulate help
26
- git.R tabulate <tools.yml> <project_conf.yml> <save_file_name_path>
26
+ git.R tabulate <tools.yml> <project_conf.yml> <cli_conf.yml> < save_file_name_path>
27
27
git.R entity help
28
- git.R entity <tools.yml> <project_conf.yml> <gitlog_file_name_path> <save_file_name_path>
28
+ git.R entity <tools.yml> <project_conf.yml> <cli_conf.yml> < gitlog_file_name_path> <save_file_name_path>
29
29
git.R entity parallel help
30
- git.R entity parallel <tools.yml> <project_conf.yml> <gitlog_file_name_path> <save_folder_name_path>
30
+ git.R entity parallel <tools.yml> <project_conf.yml> <cli_conf.yml> < gitlog_file_name_path> <save_folder_name_path>
31
31
git.R (-h | --help)
32
32
git.R --version
33
33
@@ -46,16 +46,21 @@ OPTIONS:
46
46
47
47
arguments <- docopt :: docopt(doc , version = ' Kaiaulu 0.0.0.9600' )
48
48
if (arguments [[" tabulate" ]] & arguments [[" help" ]]){
49
- cli_alert_info(" Tabulates a git log using parse_gitlog() and matches
50
- developer identities using identity_match() ." )
49
+ cli_alert_info(" Tabulates a git log using parse_gitlog(). Optionally filters
50
+ files and matches identities according to the configuration ." )
51
51
}else if (arguments [[" tabulate" ]]){
52
52
53
53
tools_path <- arguments [[" <tools.yml>" ]]
54
54
conf_path <- arguments [[" <project_conf.yml>" ]]
55
+ cli_path <- arguments [[" <cli_conf.yml>" ]]
55
56
save_path <- arguments [[" <save_file_name_path>" ]]
56
57
57
58
tool <- yaml :: read_yaml(tools_path )
58
59
conf <- yaml :: read_yaml(conf_path )
60
+ cli <- yaml :: read_yaml(cli_path )
61
+
62
+ id_match <- cli [[" git" ]][[" identity" ]][[" match" ]]
63
+ id_names_only <- cli [[" git" ]][[" identity" ]][[" names_only" ]]
59
64
60
65
perceval_path <- path.expand(tool [[" perceval" ]])
61
66
git_repo_path <- path.expand(conf [[" version_control" ]][[" log" ]])
@@ -72,33 +77,40 @@ if(arguments[["tabulate"]] & arguments[["help"]]){
72
77
if (length(filter_commit_size ) > 0 ) project_git <- project_git %> % filter_by_commit_size(commit_size = filter_commit_size )
73
78
74
79
# Identity match
75
- project_log <- list (project_git = project_git )
76
- project_log <- identity_match(project_log ,
77
- name_column = c(" author_name_email" ),
78
- assign_exact_identity ,
79
- use_name_only = TRUE ,
80
- label = " raw_name"
81
- )
82
- project_git <- project_log [[" project_git" ]]
80
+ if (id_match ){
81
+ project_log <- list (project_git = project_git )
82
+ project_log <- identity_match(project_log ,
83
+ name_column = c(" author_name_email" ),
84
+ assign_exact_identity ,
85
+ use_name_only = id_names_only ,
86
+ label = " raw_name" )
87
+ project_git <- project_log [[" project_git" ]]
88
+ }
83
89
84
90
data.table :: fwrite(project_git ,save_path )
85
91
cli_alert_success(paste0(" Tabulated git log was saved at: " ,save_path ))
86
92
}else if (arguments [[" entity" ]] & arguments [[" parallel" ]] & arguments [[" help" ]]){
87
93
cli_alert_info(" Parses changed entities using parse_gitlog_entity() in
88
94
parallel when analysing multiple time windows. Time
89
- windows are preferentially determined based on ranges
95
+ windows are preferentially determined by ranges
90
96
specified in the configuration file. If no ranges are
91
97
specified, time windows are generated based on the
92
98
window size in days starting at the first commit's date.
93
- Also matches developer identities using identity_match()." )
99
+ Optionally filters files and matches identities according to
100
+ the configuration." )
94
101
}else if (arguments [[" entity" ]] & arguments [[" parallel" ]]){
95
102
tools_path <- arguments [[" <tools.yml>" ]]
96
103
conf_path <- arguments [[" <project_conf.yml>" ]]
104
+ cli_path <- arguments [[" <cli_conf.yml>" ]]
97
105
gitlog_path <- arguments [[" <gitlog_file_name_path>" ]]
98
106
save_path <- arguments [[" <save_folder_name_path>" ]]
99
107
100
108
tool <- yaml :: read_yaml(tools_path )
101
109
conf <- yaml :: read_yaml(conf_path )
110
+ cli <- yaml :: read_yaml(cli_path )
111
+
112
+ id_match <- cli [[" git" ]][[" identity" ]][[" match" ]]
113
+ id_names_only <- cli [[" git" ]][[" identity" ]][[" names_only" ]]
102
114
103
115
# 3rd Party Tools
104
116
utags_path <- tool [[" utags" ]]
@@ -225,17 +237,18 @@ if(arguments[["tabulate"]] & arguments[["help"]]){
225
237
origin = " 1970-01-01" ,tz = " UTC" ),
226
238
changed_entities $ entity_definition_name ,
227
239
changed_entities $ n_lines_changed
228
- )]
240
+ )]
229
241
230
242
# Identity match
231
- project_log <- list (project_git = changed_entities )
232
- project_log <- identity_match(project_log ,
233
- name_column = c(" author_name_email" ),
234
- assign_exact_identity ,
235
- use_name_only = TRUE ,
236
- label = " raw_name"
237
- )
238
- changed_entities <- project_log [[" project_git" ]]
243
+ if (id_match ){
244
+ project_log <- list (project_git = changed_entities )
245
+ project_log <- identity_match(project_log ,
246
+ name_column = c(" author_name_email" ),
247
+ assign_exact_identity ,
248
+ use_name_only = id_names_only ,
249
+ label = " raw_name" )
250
+ changed_entities <- project_log [[" project_git" ]]
251
+ }
239
252
}
240
253
}
241
254
data.table :: fwrite(changed_entities ,entity_save_path )
@@ -246,16 +259,22 @@ if(arguments[["tabulate"]] & arguments[["help"]]){
246
259
247
260
cli_alert_success(paste0(" Changed entities were saved at: " , save_path ))
248
261
}else if (arguments [[" entity" ]] & arguments [[" help" ]]){
249
- cli_alert_info(" Parses changed entities using parse_gitlog_entity() and
250
- matches developer identities using identity_match()." )
262
+ cli_alert_info(" Parses changed entities using parse_gitlog_entity().
263
+ Optionally filters files and matches identities according to
264
+ the configuration." )
251
265
}else if (arguments [[" entity" ]]){
252
266
tools_path <- arguments [[" <tools.yml>" ]]
253
267
conf_path <- arguments [[" <project_conf.yml>" ]]
268
+ cli_path <- arguments [[" <cli_conf.yml>" ]]
254
269
gitlog_path <- arguments [[" <gitlog_file_name_path>" ]]
255
270
save_path <- arguments [[" <save_file_name_path>" ]]
256
271
257
272
tool <- yaml :: read_yaml(tools_path )
258
273
conf <- yaml :: read_yaml(conf_path )
274
+ cli <- yaml :: read_yaml(cli_path )
275
+
276
+ id_match <- cli [[" git" ]][[" identity" ]][[" match" ]]
277
+ id_names_only <- cli [[" git" ]][[" identity" ]][[" names_only" ]]
259
278
260
279
# 3rd Party Tools
261
280
utags_path <- tool [[" utags" ]]
@@ -285,17 +304,17 @@ if(arguments[["tabulate"]] & arguments[["help"]]){
285
304
format = " %a %b %d %H:%M:%S %Y %z" , tz = " UTC" )
286
305
287
306
changed_entities <- parse_gitlog_entity(git_repo_path ,utags_path ,project_git ,kinds ,progress_bar = TRUE )
288
- data.table :: fwrite(changed_entities ,save_path )
289
307
290
308
# Identity match
291
- project_log <- list (project_git = changed_entities )
292
- project_log <- identity_match(project_log ,
293
- name_column = c(" author_name_email" ),
294
- assign_exact_identity ,
295
- use_name_only = TRUE ,
296
- label = " raw_name"
297
- )
298
- changed_entities <- project_log [[" project_git" ]]
309
+ if (id_match ){
310
+ project_log <- list (project_git = changed_entities )
311
+ project_log <- identity_match(project_log ,
312
+ name_column = c(" author_name_email" ),
313
+ assign_exact_identity ,
314
+ use_name_only = id_names_only ,
315
+ label = " raw_name" )
316
+ changed_entities <- project_log [[" project_git" ]]
317
+ }
299
318
300
319
data.table :: fwrite(changed_entities ,save_path )
301
320
cli_alert_success(paste0(" Changed entities were saved at: " , save_path ))
0 commit comments