diff --git a/downloader/src/main/kotlin/VersionControlSystem.kt b/downloader/src/main/kotlin/VersionControlSystem.kt index 4d16e31b4861d..8c38fc5f7af4f 100644 --- a/downloader/src/main/kotlin/VersionControlSystem.kt +++ b/downloader/src/main/kotlin/VersionControlSystem.kt @@ -30,6 +30,7 @@ import org.ossreviewtoolkit.model.VcsType import org.ossreviewtoolkit.model.config.LicenseFilePatterns import org.ossreviewtoolkit.model.orEmpty import org.ossreviewtoolkit.utils.common.CommandLineTool +import org.ossreviewtoolkit.utils.common.Options import org.ossreviewtoolkit.utils.common.Plugin import org.ossreviewtoolkit.utils.common.collectMessages import org.ossreviewtoolkit.utils.common.uppercaseFirstChar @@ -387,7 +388,8 @@ abstract class VersionControlSystem( workingTree: WorkingTree, revision: String, path: String = "", - recursive: Boolean = false + recursive: Boolean = false, + options: Options = emptyMap() // VCS-specific options only ): Result /** diff --git a/downloader/src/test/kotlin/VersionControlSystemTest.kt b/downloader/src/test/kotlin/VersionControlSystemTest.kt index 9349902a37a18..195cd25bfeaab 100644 --- a/downloader/src/test/kotlin/VersionControlSystemTest.kt +++ b/downloader/src/test/kotlin/VersionControlSystemTest.kt @@ -35,6 +35,7 @@ import org.ossreviewtoolkit.model.VcsInfo import org.ossreviewtoolkit.model.VcsType import org.ossreviewtoolkit.plugins.versioncontrolsystems.git.Git import org.ossreviewtoolkit.utils.common.CommandLineTool +import org.ossreviewtoolkit.utils.common.Options class VersionControlSystemTest : WordSpec({ val vcsRoot = File("..").absoluteFile.normalize() @@ -168,6 +169,7 @@ private class VersionControlSystemTestImpl( workingTree: WorkingTree, revision: String, path: String, - recursive: Boolean + recursive: Boolean, + options: Options // VersionControlSystemTestImpl-specific configuration options only ): Result = Result.failure(UnsupportedOperationException("Unexpected invocation.")) } diff --git a/plugins/version-control-systems/git/src/main/kotlin/Git.kt b/plugins/version-control-systems/git/src/main/kotlin/Git.kt index 1f77eec9d153d..5dfd600671939 100644 --- a/plugins/version-control-systems/git/src/main/kotlin/Git.kt +++ b/plugins/version-control-systems/git/src/main/kotlin/Git.kt @@ -49,6 +49,7 @@ import org.ossreviewtoolkit.downloader.WorkingTree import org.ossreviewtoolkit.model.VcsInfo import org.ossreviewtoolkit.model.VcsType import org.ossreviewtoolkit.utils.common.CommandLineTool +import org.ossreviewtoolkit.utils.common.Options import org.ossreviewtoolkit.utils.common.Os import org.ossreviewtoolkit.utils.common.collectMessages import org.ossreviewtoolkit.utils.common.safeMkdirs @@ -170,7 +171,8 @@ class Git : VersionControlSystem(GitCommand) { workingTree: WorkingTree, revision: String, path: String, - recursive: Boolean + recursive: Boolean, + options: Options // Git-specific configuration options only ): Result = (workingTree as GitWorkingTree).useRepo { Git(this).use { git -> diff --git a/plugins/version-control-systems/git/src/main/kotlin/GitRepo.kt b/plugins/version-control-systems/git/src/main/kotlin/GitRepo.kt index 26cdcb7e28498..1793a3c239069 100644 --- a/plugins/version-control-systems/git/src/main/kotlin/GitRepo.kt +++ b/plugins/version-control-systems/git/src/main/kotlin/GitRepo.kt @@ -38,6 +38,7 @@ import org.ossreviewtoolkit.model.VcsInfo import org.ossreviewtoolkit.model.VcsType import org.ossreviewtoolkit.model.utils.parseRepoManifestPath import org.ossreviewtoolkit.utils.common.CommandLineTool +import org.ossreviewtoolkit.utils.common.Options import org.ossreviewtoolkit.utils.common.Os import org.ossreviewtoolkit.utils.common.ProcessCapture import org.ossreviewtoolkit.utils.common.collectMessages @@ -192,7 +193,8 @@ class GitRepo : VersionControlSystem(GitRepoCommand) { workingTree: WorkingTree, revision: String, path: String, - recursive: Boolean + recursive: Boolean, + options: Options // GitRepo-specific configuration options only. ): Result { val manifestRevision = revision.takeUnless { it.isBlank() } val manifestPath = workingTree.getInfo().url.parseRepoManifestPath() diff --git a/plugins/version-control-systems/mercurial/src/main/kotlin/Mercurial.kt b/plugins/version-control-systems/mercurial/src/main/kotlin/Mercurial.kt index 613ab0e117b1b..9a1bb3d04d6fc 100644 --- a/plugins/version-control-systems/mercurial/src/main/kotlin/Mercurial.kt +++ b/plugins/version-control-systems/mercurial/src/main/kotlin/Mercurial.kt @@ -28,6 +28,7 @@ import org.ossreviewtoolkit.downloader.WorkingTree import org.ossreviewtoolkit.model.VcsInfo import org.ossreviewtoolkit.model.VcsType import org.ossreviewtoolkit.utils.common.CommandLineTool +import org.ossreviewtoolkit.utils.common.Options import org.ossreviewtoolkit.utils.common.ProcessCapture const val MERCURIAL_LARGE_FILES_EXTENSION = "largefiles = " @@ -93,7 +94,13 @@ class Mercurial : VersionControlSystem(MercurialCommand) { return getWorkingTree(targetDir) } - override fun updateWorkingTree(workingTree: WorkingTree, revision: String, path: String, recursive: Boolean) = + override fun updateWorkingTree( + workingTree: WorkingTree, + revision: String, + path: String, + recursive: Boolean, + options: Options // Mercurial-specific configuration options only + ) = runCatching { // To safe network bandwidth, only pull exactly the revision we want. Do not use "-u" to update the // working tree just yet, as Mercurial would only update if new changesets were pulled. But that might diff --git a/plugins/version-control-systems/subversion/src/main/kotlin/Subversion.kt b/plugins/version-control-systems/subversion/src/main/kotlin/Subversion.kt index 5a4a217fb32f8..70ca4e706b196 100644 --- a/plugins/version-control-systems/subversion/src/main/kotlin/Subversion.kt +++ b/plugins/version-control-systems/subversion/src/main/kotlin/Subversion.kt @@ -31,6 +31,7 @@ import org.ossreviewtoolkit.downloader.VersionControlSystem import org.ossreviewtoolkit.downloader.WorkingTree import org.ossreviewtoolkit.model.VcsInfo import org.ossreviewtoolkit.model.VcsType +import org.ossreviewtoolkit.utils.common.Options import org.ossreviewtoolkit.utils.common.collectMessages import org.ossreviewtoolkit.utils.ort.OrtAuthenticator import org.ossreviewtoolkit.utils.ort.OrtProxySelector @@ -126,7 +127,13 @@ class Subversion : VersionControlSystem() { return pathRevisions.single() } - override fun updateWorkingTree(workingTree: WorkingTree, revision: String, path: String, recursive: Boolean) = + override fun updateWorkingTree( + workingTree: WorkingTree, + revision: String, + path: String, + recursive: Boolean, + options: Options // Subversion-specific configuration options only. + ) = runCatching { // Note that the path should never be part of the URL as that would root the working tree at that path, but // the path should be available in the working tree.