@@ -35,6 +35,8 @@ githist <- function (path, n = NULL, step_size = 1L, num_cores = -1L) {
35
35
}
36
36
checkmate :: assert_int (num_cores )
37
37
38
+ num_cores <- set_num_cores (num_cores )
39
+
38
40
path_cp <- fs :: path (fs :: path_temp (), basename (path ))
39
41
clean_after <- FALSE
40
42
if (fs :: path (fs :: path_dir (path )) != fs :: path_temp () &&
@@ -51,11 +53,7 @@ githist <- function (path, n = NULL, step_size = 1L, num_cores = -1L) {
51
53
h <- h [seq_len (n ), ]
52
54
}
53
55
54
- res <- pbapply :: pblapply (seq_len (nrow (h )), function (i ) {
55
- g <- gert :: git_reset_hard (ref = h $ commit [i ], repo = path_cp )
56
- pkg_date <- h $ time [i ]
57
- run_one_pkgstats (path = path_cp , pkg_date = pkg_date )
58
- })
56
+ res <- extract_pkgstats_data (h , path_cp , num_cores )
59
57
60
58
if (clean_after ) {
61
59
fs :: dir_delete (path_cp )
@@ -64,6 +62,16 @@ githist <- function (path, n = NULL, step_size = 1L, num_cores = -1L) {
64
62
collate_pkgstats (res )
65
63
}
66
64
65
+ extract_pkgstats_data <- function (log , path , num_cores ) {
66
+
67
+ res <- pbapply :: pblapply (seq_len (nrow (log )), function (i ) {
68
+ g <- gert :: git_reset_hard (ref = log $ commit [i ], repo = path )
69
+ run_one_pkgstats (path = path , pkg_date = log $ time [i ])
70
+ })
71
+
72
+ return (res )
73
+ }
74
+
67
75
collate_pkgstats <- function (x ) {
68
76
nms <- names (x [[1 ]])
69
77
nms2df <- nms [seq_len (which (nms == " loc" ) - 1L )]
0 commit comments