Implement resolver for subversion repositories

All subversion URIs have to be prefixed with 'svn:' to separate them
from URIs for other resolvers. For example, 'svn:https://server/repo'
can now be used.
This commit is contained in:
Sanjin Sehic 2011-12-19 15:28:26 +01:00 committed by Mark Harrah
parent bc4443b408
commit e4f809953f
2 changed files with 27 additions and 0 deletions

View File

@ -42,6 +42,7 @@ object RetrieveUnit
def apply(info: ResolveInfo): Option[() => File] =
{
info.uri match {
case Scheme("svn") | Scheme("svn+ssh") => Resolvers.subversion(info)
case Scheme("hg") => Resolvers.mercurial(info)
case Scheme("git") => Resolvers.git(info)
case Path(path) if path.endsWith(".git") => Resolvers.git(info)

View File

@ -40,6 +40,32 @@ object Resolvers
}
}
val subversion: Resolver = (info: ResolveInfo) => {
def normalized(uri: URI) = uri.copy(scheme = "svn")
def checkout(at: URI, into: File, revision: Option[String]) =
{
creates(into) {
revision match {
case Some(r) =>
run(None, "svn", "checkout", "-r", r, at.toASCIIString, into.getAbsolutePath)
case None =>
run(None, "svn", "checkout", at.toASCIIString, into.getAbsolutePath)
}
}
}
val uri = info.uri.withoutMarkerScheme
Some {
() =>
checkout(
at = uri.withoutFragment,
into = uniqueSubdirectoryFor(normalized(uri), in = info.staging),
revision = Option(uri.getFragment)
)
}
}
val mercurial: Resolver = new DistributedVCS
{
override val scheme = "hg"