Skip to content

Commit

Permalink
Subversion: Fix the remote URL to not contain a branch / tag name
Browse files Browse the repository at this point in the history
This is a fixup for 103a3c1 and fixes #5232.

Signed-off-by: Sebastian Schuberth <sebastian.schuberth@bosch.io>
  • Loading branch information
sschuberth committed Sep 23, 2022
1 parent b8b0463 commit 0cddfce
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class SubversionWorkingTreeFunTest : StringSpec({
workingTree.isValid() shouldBe true
workingTree.getInfo() shouldBe VcsInfo(
type = VcsType.SUBVERSION,
url = "https://svn.code.sf.net/p/docutils/code/trunk/docutils",
url = "https://svn.code.sf.net/p/docutils/code",
revision = "8207",
path = ""
)
Expand Down
5 changes: 2 additions & 3 deletions downloader/src/main/kotlin/vcs/Subversion.kt
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,8 @@ class Subversion : VersionControlSystem() {
)
} ?: run {
// This code path updates the working tree to a symbolic revision.
val svnUrl = SVNURL.parseURIEncoded(
"${workingTree.getRemoteUrl()}/$revision"
)
val fullUrl = (workingTree as SubversionWorkingTree).getFullUrl()
val svnUrl = SVNURL.parseURIEncoded("$fullUrl/$revision")

// First switch the (empty) working tree to the requested branch / tag.
clientManager.updateClient.doSwitch(
Expand Down
11 changes: 7 additions & 4 deletions downloader/src/main/kotlin/vcs/SubversionWorkingTree.kt
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class SubversionWorkingTree(

override fun isShallow() = false

override fun getRemoteUrl() = doSvnInfo()?.url?.toString().orEmpty()
override fun getRemoteUrl() = doSvnInfo()?.repositoryRootURL?.toString().orEmpty()

override fun getRevision() = doSvnInfo()?.committedRevision?.number?.toString().orEmpty()

Expand All @@ -57,14 +57,17 @@ class SubversionWorkingTree(

override fun listRemoteTags() = listRemoteRefs("tags")

fun getFullUrl() = doSvnInfo()?.url?.toString().orEmpty()

private fun listRemoteRefs(namespace: String): List<String> {
val refs = mutableListOf<String>()
val remoteUrl = getRemoteUrl()
val fullUrl = getFullUrl()

val projectRoot = if (directoryNamespaces.any { "/$it/" in remoteUrl }) {
doSvnInfo()?.repositoryRootURL?.toString().orEmpty()
} else {
val projectRoot = if (directoryNamespaces.any { "/$it/" in fullUrl }) {
remoteUrl
} else {
fullUrl
}

// We assume a single project directory layout.
Expand Down

0 comments on commit 0cddfce

Please sign in to comment.