Skip to content

Commit 584e4b8

Browse files
committed
Merge branch '342810-expand_review_revision_limit' into 372284-simpler_EEF
2 parents 23d9e64 + 24676af commit 584e4b8

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

R/review.R

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,20 @@ REV_load_annotation_info <- function(folder_contents, review, dataset_lists) {
259259

260260
base_timestamp <- NA_real_
261261
data_timestamps_st <- rep(NA_real_, row_count)
262+
262263
# <domain>_0000.base
263-
base_file_path <- file.path(dataset_lists_name, paste0(dataset_review_name, "_0000.base"))
264-
if (base_file_path %in% names(folder_contents)) {
264+
# - Older versions of the review functionality devoted three digits to the `.base` and `.delta` sequence numbers.
265+
# The current version uses four digits. Here we detect the one that was used for this particular domain (if it
266+
# exists) and use it for the associated delta files.
267+
base_file_path_pattern <- sprintf("^%s_0+.base$", file.path(dataset_lists_name, dataset_review_name))
268+
base_file_path <- grep(base_file_path_pattern, names(folder_contents), value = TRUE)
269+
if (length(base_file_path) > 1L) {
270+
error <- c(error, paste0("[", dataset_review_name, "] ", "Multiple `.base` files found:\n",
271+
paste(sprintf("`%s`", base_file_path), collapse = ", "), ".\n"))
272+
base_file_path <- sort(base_file_path)[[1]]
273+
}
274+
275+
if (length(base_file_path) == 1) { # existing `.base` file
265276
contents <- folder_contents[[base_file_path]]
266277

267278
sorted_delta_file_paths <- local({
@@ -390,7 +401,8 @@ REV_load_annotation_info <- function(folder_contents, review, dataset_lists) {
390401
append_IO_action(list(kind = "write", path = file_path, contents = new_delta_contents, offset = 0L))
391402
}
392403
}
393-
} else {
404+
} else { # new `.base` file
405+
base_file_path <- file.path(dataset_lists_name, paste0(dataset_review_name, "_0000.base"))
394406
contents <- RS_compute_base_memory(dataset_review_name, dataset, id_vars, tracked_vars)
395407
if (inherits(contents, "simpleCondition")) {
396408
# IMPORTANT: Not being able to compute the base info is too severe an error to recover from, so we error out

0 commit comments

Comments
 (0)