Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ensure packages restored from GitLab / Bitbucket get RemoteType field #564

Merged
merged 1 commit into from
Jun 18, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions R/restore.R
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ getSourceForPkgRecord <- function(pkgRecord,
}

remote_info <- as.data.frame(c(list(
RemoteType = "bitbucket",
RemoteRepo = pkgRecord$remote_repo,
RemoteUsername = pkgRecord$remote_username,
RemoteRef = pkgRecord$remote_ref,
Expand Down Expand Up @@ -485,6 +486,7 @@ getSourceForPkgRecord <- function(pkgRecord,
}

remote_info <- as.data.frame(c(list(
RemoteType = "gitlab",
RemoteRepo = pkgRecord$remote_repo,
RemoteUsername = pkgRecord$remote_username,
RemoteRef = pkgRecord$remote_ref,
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/projects/falsy-gitlab/deps.R
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
library(falsy)
14 changes: 14 additions & 0 deletions tests/testthat/projects/falsy-gitlab/packrat/packrat.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
PackratFormat: 1.4
PackratVersion: 0.5.0.11
RVersion: 3.5.1
Repos: CRAN=https://cran.rstudio.com/

Package: falsy
Source: gitlab
Version: 1.0.1
Hash: cd9f70fd26fa58a4b3070370b16b8660
RemoteRepo: falsy
RemoteUsername: jimhester
RemoteRef: master
RemoteSha: 26a36cf957a18569e311ef75b6f61f822de945ef
RemoteHost: gitlab.com
14 changes: 14 additions & 0 deletions tests/testthat/test-packrat.R
Original file line number Diff line number Diff line change
Expand Up @@ -268,4 +268,18 @@ withTestContext({
.snapshotImpl(projRoot, implicit.packrat.dependency = FALSE,
snapshot.sources = FALSE)
})

test_that("Packages restored from GitLab have RemoteType in their DESCRIPTION", {
skip_on_cran()
projRoot <- cloneTestProject("falsy-gitlab")

# ignore R version warnings
suppressWarnings(restore(projRoot))

# validate the installed package has properly annotated DESCRIPTION
descpath <- file.path(libDir(projRoot), "falsy/DESCRIPTION")
desc <- as.data.frame(readDcf(descpath), stringsAsFactors = FALSE)
expect_true(desc$RemoteType == "gitlab")
})

})