mirror of https://github.com/sbt/sbt.git
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:
parent
bc4443b408
commit
e4f809953f
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
Loading…
Reference in New Issue