[Pkg-mozext-commits] [adblock-plus] 03/17: Issue 2310 - Handle alternative syntax for Git SSH URLs.
David Prévot
taffit at moszumanska.debian.org
Mon Jun 8 20:50:30 UTC 2015
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository adblock-plus.
commit e272f9d75713af27f64187ec3d3370fe66e75f01
Author: Dave Barker <kzar at kzar.co.uk>
Date: Thu Apr 30 18:29:10 2015 +0200
Issue 2310 - Handle alternative syntax for Git SSH URLs.
---
ensure_dependencies.py | 19 ++++++++++++++++---
1 file changed, 16 insertions(+), 3 deletions(-)
diff --git a/ensure_dependencies.py b/ensure_dependencies.py
index d8af9e7..b6557d0 100755
--- a/ensure_dependencies.py
+++ b/ensure_dependencies.py
@@ -79,6 +79,9 @@ class Mercurial():
module = os.path.relpath(target, repo)
_ensure_line_exists(ignore_path, module)
+ def postprocess_url(self, url):
+ return url
+
class Git():
def istype(self, repodir):
return os.path.exists(os.path.join(repodir, ".git"))
@@ -104,6 +107,12 @@ class Git():
exclude_file = os.path.join(repo, ".git", "info", "exclude")
_ensure_line_exists(exclude_file, module)
+ def postprocess_url(self, url):
+ # Handle alternative syntax of SSH URLS
+ if "@" in url and ":" in url and not urlparse.urlsplit(url).scheme:
+ return "ssh://" + url.replace(":", "/", 1)
+ return url
+
repo_types = OrderedDict((
("hg", Mercurial()),
("git", Git()),
@@ -187,10 +196,14 @@ def ensure_repo(parentrepo, target, roots, sourcename):
if type is None:
raise Exception("No valid source found to create %s" % target)
- if os.path.exists(roots[type]):
- url = os.path.join(roots[type], sourcename)
+ postprocess_url = repo_types[type].postprocess_url
+ root = postprocess_url(roots[type])
+ sourcename = postprocess_url(sourcename)
+
+ if os.path.exists(root):
+ url = os.path.join(root, sourcename)
else:
- url = urlparse.urljoin(roots[type], sourcename)
+ url = urlparse.urljoin(root, sourcename)
logging.info("Cloning repository %s into %s" % (url, target))
repo_types[type].clone(url, target)
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus.git
More information about the Pkg-mozext-commits
mailing list