Skip to content
Open
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
9 changes: 6 additions & 3 deletions src/groovy/grails/plugin/svn/SvnClient.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -404,12 +404,15 @@ class SvnClient {
* @return A tuple of base URL, username, and password.
*/
protected final tokenizeUrl(url) {
// Parse the URL using SVNKit.

def result = []

def svnUrl = SVNURL.parseURIDecoded(url)

// Start with the base URL.
def result = []
if (!svnUrl.hasPort()) {
if (svnUrl.protocol == "file") {
result << url
} else if (!svnUrl.hasPort()) {
// URL doesn't explicitly specify a port, so we don't include
// it in the base URL either.
result << "${svnUrl.protocol}://${svnUrl.host}${svnUrl.path}".toString()
Expand Down
12 changes: 12 additions & 0 deletions test/unit/grails/plugin/svn/SvnClientUnitTests.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,18 @@ class SvnClientUnitTests extends GMockTestCase {
}
}

void testConstructorWithFileUrl() {
mockClientConstruction()

play {
def testClient = new SvnClient("file:///local/repository/path")
println testClient.repoUrl.dump()
assert testClient.repoUrl?.path == "/local/repository/path"
assert testClient.repoUrl?.protocol == "file"
assert testClient.projectPath == ""
}
}

void testSetCredentials() {
def mockUtil = mockClientConstruction()
mockUtil.static.createDefaultAuthenticationManager("dilbert", "password")
Expand Down