You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@allura.apache.org by br...@apache.org on 2012/09/19 20:43:27 UTC

[8/50] git commit: [#4901] Keep original URL when cloning repo from local path

[#4901] Keep original URL when cloning repo from local path

Signed-off-by: Cory Johns <jo...@geek.net>


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

Branch: refs/heads/master
Commit: 110ba68836f30cdc9222e5a128591cfef10c9776
Parents: f64d274
Author: Cory Johns <jo...@geek.net>
Authored: Mon Sep 17 17:06:53 2012 +0000
Committer: Cory Johns <jo...@geek.net>
Committed: Mon Sep 17 17:06:53 2012 +0000

----------------------------------------------------------------------
 Allura/allura/model/repository.py |    5 +++--
 ForgeGit/forgegit/git_main.py     |    5 +++--
 ForgeHg/forgehg/hg_main.py        |    5 +++--
 ForgeSVN/forgesvn/svn_main.py     |    5 +++--
 4 files changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/110ba688/Allura/allura/model/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py
index 3f263ad..9f202a9 100644
--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -46,7 +46,7 @@ class RepositoryImplementation(object):
     def init(self): # pragma no cover
         raise NotImplementedError, 'init'
 
-    def clone_from(self, source_path, source_url): # pragma no cover
+    def clone_from(self, source_url): # pragma no cover
         raise NotImplementedError, 'clone_from'
 
     def commit(self, revision): # pragma no cover
@@ -218,7 +218,8 @@ class Repository(Artifact, ActivityObject):
         self.upstream_repo.name = source_name
         self.upstream_repo.url = source_url
         session(self).flush(self)
-        self._impl.clone_from(source_url)
+        source = source_path if source_path else source_url
+        self._impl.clone_from(source)
 
     def log(self, branch='master', offset=0, limit=10):
         return list(self._log(rev=branch, skip=offset, max_count=limit))

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/110ba688/ForgeGit/forgegit/git_main.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/git_main.py b/ForgeGit/forgegit/git_main.py
index 251e820..417dbaa 100644
--- a/ForgeGit/forgegit/git_main.py
+++ b/ForgeGit/forgegit/git_main.py
@@ -53,15 +53,16 @@ class ForgeGitApp(RepositoryApp):
         cloned_from_project_id = self.config.options.get('cloned_from_project_id')
         cloned_from_repo_id = self.config.options.get('cloned_from_repo_id')
         init_from_url = self.config.options.get('init_from_url')
+        init_from_path = self.config.options.get('init_from_path')
         if cloned_from_project_id is not None:
             cloned_from = GM.Repository.query.get(_id=cloned_from_repo_id)
             allura.tasks.repo_tasks.clone.post(
                 cloned_from_path=cloned_from.full_fs_path,
                 cloned_from_name=cloned_from.app.config.script_name(),
                 cloned_from_url=cloned_from.full_fs_path)
-        elif init_from_url:
+        elif init_from_url or init_from_path:
             allura.tasks.repo_tasks.clone.post(
-                cloned_from_path=None,
+                cloned_from_path=init_from_path,
                 cloned_from_name=None,
                 cloned_from_url=init_from_url)
         else:

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/110ba688/ForgeHg/forgehg/hg_main.py
----------------------------------------------------------------------
diff --git a/ForgeHg/forgehg/hg_main.py b/ForgeHg/forgehg/hg_main.py
index dfefbba..eb23b09 100644
--- a/ForgeHg/forgehg/hg_main.py
+++ b/ForgeHg/forgehg/hg_main.py
@@ -53,15 +53,16 @@ class ForgeHgApp(RepositoryApp):
         cloned_from_project_id = self.config.options.get('cloned_from_project_id')
         cloned_from_repo_id = self.config.options.get('cloned_from_repo_id')
         init_from_url = self.config.options.get('init_from_url')
+        init_from_path = self.config.options.get('init_from_path')
         if cloned_from_project_id is not None:
             cloned_from = HM.Repository.query.get(_id=cloned_from_repo_id)
             allura.tasks.repo_tasks.clone.post(
                 cloned_from_path=cloned_from.full_fs_path,
                 cloned_from_name=cloned_from.app.config.script_name(),
                 cloned_from_url=cloned_from.full_fs_path)
-        elif init_from_url:
+        elif init_from_url or init_from_path:
             allura.tasks.repo_tasks.clone.post(
-                cloned_from_path=None,
+                cloned_from_path=init_from_path,
                 cloned_from_name=None,
                 cloned_from_url=init_from_url)
         else:

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/110ba688/ForgeSVN/forgesvn/svn_main.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/svn_main.py b/ForgeSVN/forgesvn/svn_main.py
index ed03d87..45bd189 100644
--- a/ForgeSVN/forgesvn/svn_main.py
+++ b/ForgeSVN/forgesvn/svn_main.py
@@ -61,9 +61,10 @@ class ForgeSVNApp(RepositoryApp):
             status='initializing')
         ThreadLocalORMSession.flush_all()
         init_from_url = self.config.options.get('init_from_url')
-        if init_from_url:
+        init_from_path = self.config.options.get('init_from_path')
+        if init_from_url or init_from_path:
             allura.tasks.repo_tasks.clone.post(
-                cloned_from_path=None,
+                cloned_from_path=init_from_path,
                 cloned_from_name=None,
                 cloned_from_url=init_from_url)
         else: