@@ -75,11 +75,11 @@ clonePackage <- function(pkg_name, repo_dir) {
75
75
if (! dir.exists(out_path )) {
76
76
printMessage(" Cloning repository... " , 2 , appendLF = FALSE )
77
77
gert :: git_clone(paste0(" https://git.bioconductor.org/packages/" , pkg_name ),
78
- path = file.path( repo_dir , pkg_name ) ,
78
+ path = out_path ,
79
79
verbose = FALSE )
80
- message( " done" )
80
+ printMessage( " done" , 0 , timestamp = FALSE )
81
81
} else {
82
- message (" Directory already exists" )
82
+ printMessage (" Directory already exists" , 0 , timestamp = FALSE )
83
83
}
84
84
}
85
85
@@ -103,16 +103,10 @@ checkoutBranches <- function(pkg_name, repo_dir) {
103
103
gert :: git_branch_checkout(branch = basename(b ), repo = repo )
104
104
)
105
105
}
106
- # # finish with the devel/master branch checkout
107
- if (any(grepl(" devel" , branches $ name ))) {
108
- suppressMessages(
109
- gert :: git_branch_checkout(branch = " devel" , repo = repo )
110
- )
111
- } else {
112
- suppressMessages(
113
- gert :: git_branch_checkout(branch = " master" , repo = repo )
114
- )
115
- }
106
+ # # finish with the devel branch checkout
107
+ suppressMessages(
108
+ gert :: git_branch_checkout(branch = " devel" , repo = repo )
109
+ )
116
110
printMessage(" done" , 2 )
117
111
}
118
112
}
@@ -137,16 +131,11 @@ updateBranches <- function(pkg_name, repo_dir) {
137
131
gert :: git_pull(repo = repo , verbose = FALSE )
138
132
)
139
133
}
140
- # # finish with the devel/master branch checkout
141
- if (any(grepl(" devel" , branches $ name ))) {
142
- suppressMessages(
143
- gert :: git_branch_checkout(branch = " devel" , repo = repo )
144
- )
145
- } else {
146
- suppressMessages(
147
- gert :: git_branch_checkout(branch = " master" , repo = repo )
148
- )
149
- }
134
+ # # finish with the devel branch checkout
135
+ suppressMessages(
136
+ gert :: git_branch_checkout(branch = " devel" , repo = repo )
137
+ )
138
+
150
139
printMessage(" done" , 2 )
151
140
}
152
141
@@ -158,23 +147,15 @@ processMostRecentCommit <- function(pkg_name, repo_dir) {
158
147
stop(" directory doesn't exist" )
159
148
}
160
149
161
- # # sort branches by commit time. Sometimes RELEASE and master will be identical
150
+ # # sort branches by commit time. Sometimes RELEASE and devel will be identical
162
151
# # Sorting on branch isn't reliable, so we resolve this below
163
- top3commits <- gert :: git_branch_list(local = TRUE , repo = repo ) %> %
152
+ top2commits <- gert :: git_branch_list(local = TRUE , repo = repo ) %> %
153
+ filter(grepl(" (RELEASE_[1-9]_[0-9]{1,2}$|devel)" , name )) %> %
164
154
arrange(desc(updated )) %> %
165
- slice(1 : 3 )
166
-
167
- # # remove the master branch from this test if devel exists
168
- if (" devel" %in% top3commits $ name ) {
169
- top2commits <- top3commits %> % filter(name != " master" )
170
- devel_branch <- " devel"
171
- } else {
172
- top2commits <- top3commits %> % slice(1 : 2 )
173
- devel_branch <- " master"
174
- }
155
+ slice(1 : 2 )
175
156
176
157
if (identical(top2commits $ updated [1 ], top2commits $ updated [2 ])) {
177
- most_recent_commit <- filter(top2commits , name == devel_branch )
158
+ most_recent_commit <- filter(top2commits , name == " devel " )
178
159
} else {
179
160
most_recent_commit <- slice(top2commits , 1 )
180
161
}
@@ -201,6 +182,19 @@ processMostRecentCommit <- function(pkg_name, repo_dir) {
201
182
return (json_content )
202
183
}
203
184
185
+ # # create a placeholder table when the site is being updated
186
+ createUnderConstruction <- function (repo_dir ) {
187
+
188
+ json_content <- c(
189
+ " The code browser is undergoing maintenance" ,
190
+ " It will return soon"
191
+ )
192
+
193
+ message <- toJSON(list (data = list (json_content )), pretty = TRUE )
194
+
195
+ writeLines(message , con = file.path(repo_dir , " packages.json" ))
196
+ }
197
+
204
198
205
199
initialiseRepositories <- function (repo_dir , manifest , n_pkgs ) {
206
200
@@ -257,7 +251,7 @@ updateCommitMessages <- function(repo_dir, manifest, pkgs) {
257
251
# # munging to get json in the format for DataTable HTML
258
252
json_pkg_list <- toJSON(list (data = do.call(rbind , commit_messages )), pretty = TRUE )
259
253
writeLines(json_pkg_list , con = file.path(repo_dir , " packages.json" ))
260
- message( " done" )
254
+ printMessage( " done" , 0 , timestamp = FALSE )
261
255
262
256
}
263
257
@@ -298,7 +292,7 @@ updateRepositories <- function(repo_dir, manifest, update_all = FALSE) {
298
292
clonePackage(pkg , repo_dir = repo_dir )
299
293
},
300
294
error = function (cond ) {
301
- message (" Failed! " )
295
+ printMessage (" Failed to clone package! " , 0 , timestamp = FALSE )
302
296
return (TRUE )
303
297
})
304
298
if (isTRUE(skip )) {
@@ -311,7 +305,8 @@ updateRepositories <- function(repo_dir, manifest, update_all = FALSE) {
311
305
updateBranches(pkg , repo_dir = repo_dir )
312
306
},
313
307
error = function (cond ) {
314
- printMessage(" Failed!" , 4 )
308
+ printMessage(sprintf(" Failed to update branches! Message: %s" , cond ),
309
+ 0 , timestamp = TRUE )
315
310
return (TRUE )
316
311
})
317
312
if (isTRUE(skip )) { pkgs <- setdiff(pkgs , pkg ) }
0 commit comments