vimc / orderly
Showing 3 of 6 files from the diff.

@@ -241,7 +241,7 @@
Loading
241 241
##'   be included.
242 242
##'
243 243
##' @param ref Optional reference, indicating which branch should be
244 -
##'   used.  This cannot be used if the remote has `master_only`
244 +
##'   used.  This cannot be used if the remote has `default_branch_only`
245 245
##'   set.
246 246
##'
247 247
##' @param instance Select instance of the source database to be used,

@@ -234,7 +234,7 @@
Loading
234 234
  archive
235 235
}
236 236
237 -
unzip_git_demo <- function(path = tempfile()) {
237 +
unzip_git_demo <- function(path = tempfile(), default_branch = "master") {
238 238
  tmp <- tempfile()
239 239
  dir.create(tmp, FALSE, TRUE)
240 240
  demo <- getOption("orderly.server.demo", build_git_demo())
@@ -244,14 +244,23 @@
Loading
244 244
             no.. = TRUE)
245 245
  file_copy(src, path, recursive = TRUE)
246 246
  unlink(tmp, recursive = TRUE)
247 +
  if (default_branch != "master") {
248 +
    ## If git changes it's mind about what the default branch is called,
249 +
    ## this will fail, we should probably detect this, but it's likely
250 +
    ## that will break build_git_demo too
251 +
    gert::git_branch_move("master", default_branch, force = TRUE,
252 +
                          repo = path)
253 +
  }
247 254
  path
248 255
}
249 256
250 257
prepare_orderly_git_example <- function(path = tempfile(), run_report = FALSE,
251 -
                                        branch = "master") {
258 +
                                        branch = default_branch,
259 +
                                        default_branch = "master") {
252 260
  path_upstream <- file.path(path, "upstream")
253 -
  unzip_git_demo(path)
254 -
  unzip_git_demo(path_upstream)
261 +
  unzip_git_demo(path, default_branch)
262 +
  unzip_git_demo(path_upstream, default_branch)
263 +
255 264
  git_checkout_branch(branch, root = path)
256 265
  git_checkout_branch(branch, root = path_upstream)
257 266

@@ -298,7 +298,9 @@
Loading
298 298
    d <- remote[[name]]
299 299
    check_fields(d, sprintf("%s:remote:%s", filename, name),
300 300
                 c("driver", "args"),
301 -
                 c("url", "slack_url", "teams_url", "primary", "master_only"))
301 +
                 c("url", "slack_url", "teams_url", "primary",
302 +
                   "master_only", "default_branch_only",
303 +
                   "default_branch"))
302 304
    field_name <- function(nm) {
303 305
      sprintf("%s:remote:%s:%s", filename, name, nm)
304 306
    }
@@ -318,10 +320,36 @@
Loading
318 320
    } else {
319 321
      assert_scalar_logical(d$primary, field_name("primary"))
320 322
    }
321 -
    if (is.null(d$master_only)) {
322 -
      d$master_only <- FALSE
323 +
324 +
    if (!is.null(d$master_only)) {
325 +
      if (!is.null(d$default_branch_only)) {
326 +
        msg <- c("Can't specify both 'master_only' and 'default_branch_only': ",
327 +
                 sprintf("see %s:remote:%s", filename, name))
328 +
        stop(msg)
329 +
      }
330 +
      msg <- c("The 'master_only' field (used in",
331 +
               sprintf("%s:remote:%s", filename, name),
332 +
               "is deprecated and replaced with 'default_branch_only'",
333 +
               "and will be dropped in a future version of",
334 +
               "orderly.  Please rename it in your orderly_config.yml")
335 +
      orderly_warning(flow_text(msg))
336 +
      d$default_branch_only <- d$master_only
337 +
      d$master_only <- NULL
338 +
    }
339 +
340 +
    if (is.null(d$default_branch_only)) {
341 +
      d$default_branch_only <- FALSE
342 +
    } else {
343 +
      assert_scalar_logical(d$default_branch_only,
344 +
                            field_name("default_branch_only"))
345 +
    }
346 +
347 +
    ## use '[[' not '$' here to avoid partial matches.
348 +
    if (is.null(d[["default_branch"]])) {
349 +
      d[["default_branch"]] <- "master"
323 350
    } else {
324 -
      assert_scalar_logical(d$master_only, field_name("master_only"))
351 +
      assert_scalar_character(d[["default_branch"]],
352 +
                              field_name("default_branch"))
325 353
    }
326 354
327 355
    d$driver <- check_symbol_from_str(d$driver, field_name("driver"))
Files Coverage
R 99.96%
Project Totals (41 files) 99.96%

No yaml found.

Create your codecov.yml to customize your Codecov experience

Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading