Skip to content

Commit a10eef9

Browse files
[skip style] [skip vbump] Restyle files
1 parent 8229d4d commit a10eef9

File tree

1 file changed

+15
-12
lines changed

1 file changed

+15
-12
lines changed

R/utils.R

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,22 @@ base_pkgs <- function() {
3131
#' get_ppm_snapshot_by_date("2023-08-01")
3232
#' get_ppm_snapshot_by_date(Sys.Date() + 10)
3333
get_ppm_snapshot_by_date <- function(date) {
34-
tryCatch({
35-
# https://github.com/r-lib/pkgcache/issues/110
36-
# pkgcache::repo_resolve(sprintf("PPM@%s", as.character(as.Date(date) + 1)))
37-
snaps <- pkgcache::ppm_snapshots()
38-
date_snap <- as.character(snaps[as.Date(snaps$date) > as.Date(date), "date"][1])
39-
if (length(date_snap) == 0) {
40-
stop("No PPM snapshot found for the given date.")
34+
tryCatch(
35+
{
36+
# https://github.com/r-lib/pkgcache/issues/110
37+
# pkgcache::repo_resolve(sprintf("PPM@%s", as.character(as.Date(date) + 1)))
38+
snaps <- pkgcache::ppm_snapshots()
39+
date_snap <- as.character(snaps[as.Date(snaps$date) > as.Date(date), "date"][1])
40+
if (length(date_snap) == 0) {
41+
stop("No PPM snapshot found for the given date.")
42+
}
43+
file.path(pkgcache::ppm_repo_url(), date_snap)
44+
gsub("latest", date_snap, pkgcache::repo_resolve("PPM@latest"))
45+
},
46+
error = function(err) {
47+
pkgcache::repo_resolve("PPM@latest")
4148
}
42-
file.path(pkgcache::ppm_repo_url(), date_snap)
43-
gsub("latest", date_snap, pkgcache::repo_resolve("PPM@latest"))
44-
}, error = function(err) {
45-
pkgcache::repo_resolve("PPM@latest")
46-
})
49+
)
4750
}
4851

4952
#' Resolve the dependencies of a package based on its release date + 1.

0 commit comments

Comments
 (0)