From 5ca9f31da121d2d998edf2e70221f16f444d537a Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Mon, 1 Mar 2010 17:23:22 -0500 Subject: [fedpkg-vcs] Change expected VCS scheme closer to maven Now require a type in front. --- fedpkg-vcs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/fedpkg-vcs b/fedpkg-vcs index 3b73fff..f008916 100755 --- a/fedpkg-vcs +++ b/fedpkg-vcs @@ -63,14 +63,21 @@ class Vcs(object): subprocess.check_call(*args, **kwargs) @classmethod - def new_from_url(cls, url): + def new_from_spec(cls, spec): + """See http://maven.apache.org/scm/scm-url-format.html ; we use this format, + but without the "scm:" prefix.""" + # Hack for backwards compatibility + if spec.startswith('git://'): + (vcstype, url) = ('git', spec) + else: + (vcstype, url) = spec.split(':', 1) orig = urlparse.urlsplit(url) # We want to support fragments, even if the URL type isn't recognized. So change the # scheme to http temporarily. temp = urlparse.urlunsplit(('http', orig.netloc, orig.path, orig.query, orig.fragment)) new = urlparse.urlsplit(temp) combined = urlparse.SplitResult(orig.scheme, new.netloc, new.path, new.query, new.fragment) - if combined.scheme == 'git': + if vcstype == 'git': return GitVcs(combined) class GitVcs(Vcs): @@ -453,7 +460,7 @@ def main(): sys.stderr.write(unicode(e) + '\n') sys.exit(1) - vcs = Vcs.new_from_url(vcsurl) + vcs = Vcs.new_from_spec(vcsurl) vcsdir = '%s.%s' % (spec.get_name(), vcs.get_scheme()) opts = {'force': force, -- cgit