allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [3/4] git commit: [#7381] update code importing for GC hosted urls
Date Thu, 29 May 2014 21:08:11 GMT
[#7381] update code importing for GC hosted urls


Project: http://git-wip-us.apache.org/repos/asf/allura/repo
Commit: http://git-wip-us.apache.org/repos/asf/allura/commit/d66024bd
Tree: http://git-wip-us.apache.org/repos/asf/allura/tree/d66024bd
Diff: http://git-wip-us.apache.org/repos/asf/allura/diff/d66024bd

Branch: refs/heads/db/7381
Commit: d66024bd683a4612d6d26497ec29262619421245
Parents: d99a1c7
Author: Dave Brondsema <dbrondsema@slashdotmedia.com>
Authored: Thu May 29 19:54:02 2014 +0000
Committer: Dave Brondsema <dbrondsema@slashdotmedia.com>
Committed: Thu May 29 19:54:02 2014 +0000

----------------------------------------------------------------------
 ForgeImporters/forgeimporters/google/code.py         | 15 ++++++++++-----
 .../forgeimporters/google/tests/test_code.py         | 12 ++++++++++++
 2 files changed, 22 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/d66024bd/ForgeImporters/forgeimporters/google/code.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/google/code.py b/ForgeImporters/forgeimporters/google/code.py
index 13d388d..6a3f43c 100644
--- a/ForgeImporters/forgeimporters/google/code.py
+++ b/ForgeImporters/forgeimporters/google/code.py
@@ -42,17 +42,22 @@ from forgeimporters.base import (
 )
 from forgeimporters.google import GoogleCodeProjectExtractor
 from forgeimporters.google import GoogleCodeProjectNameValidator
-
+from forgeimporters.google import split_project_name
 
 REPO_URLS = {
-    'svn': 'http://{0}.googlecode.com/svn/',
-    'git': 'https://code.google.com/p/{0}/',
-    'hg': 'https://code.google.com/p/{0}/',
+    'svn': 'http://{project_name}.googlecode.com/svn/',
+    'svn-hosted': 'http://svn.codespot.com{hosted_domain_prefix}/{project_name}/',
+    'git': 'https://code.google.com{hosted_domain_prefix}/p/{project_name}/',
+    'hg': 'https://code.google.com{hosted_domain_prefix}/p/{project_name}/',
 }
 
 
 def get_repo_url(project_name, type_):
-    return REPO_URLS[type_].format(project_name)
+    hosted_domain_prefix, project_name = split_project_name(project_name)
+    if hosted_domain_prefix and type_ == 'svn':
+        type_ = 'svn-hosted'
+    return REPO_URLS[type_].format(project_name=project_name,
+                                   hosted_domain_prefix=hosted_domain_prefix)
 
 
 class GoogleRepoImportForm(fe.schema.Schema):

http://git-wip-us.apache.org/repos/asf/allura/blob/d66024bd/ForgeImporters/forgeimporters/google/tests/test_code.py
----------------------------------------------------------------------
diff --git a/ForgeImporters/forgeimporters/google/tests/test_code.py b/ForgeImporters/forgeimporters/google/tests/test_code.py
index b52ec21..1b6cacc 100644
--- a/ForgeImporters/forgeimporters/google/tests/test_code.py
+++ b/ForgeImporters/forgeimporters/google/tests/test_code.py
@@ -48,6 +48,18 @@ class TestGetRepoUrl(TestCase):
         r = get_repo_url('projname', 'hg')
         self.assertEqual(r, 'https://code.google.com/p/projname/')
 
+    def test_svn_hosted(self):
+        r = get_repo_url('a/eclipselabs.org/p/projname', 'svn')
+        self.assertEqual(r, 'http://svn.codespot.com/a/eclipselabs.org/projname/')
+
+    def test_git_hosted(self):
+        r = get_repo_url('a/eclipselabs.org/p/projname', 'git')
+        self.assertEqual(r, 'https://code.google.com/a/eclipselabs.org/p/projname/')
+
+    def test_hg_hosted(self):
+        r = get_repo_url('a/eclipselabs.org/p/projname', 'hg')
+        self.assertEqual(r, 'https://code.google.com/a/eclipselabs.org/p/projname/')
+
 
 class TestGoogleRepoImporter(TestCase):
 


Mime
View raw message