allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brond...@apache.org
Subject [1/2] allura git commit: [#8142] remove clone_command duplication in ForgeSVN
Date Thu, 19 Jan 2017 20:41:39 GMT
Repository: allura
Updated Branches:
  refs/heads/db/8142 [created] 0df1709c3


[#8142] remove clone_command duplication in ForgeSVN


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

Branch: refs/heads/db/8142
Commit: ff370b6533edd1865003855559f1f4e92482403e
Parents: e449bd0
Author: Dave Brondsema <dave@brondsema.net>
Authored: Tue Jan 17 13:54:16 2017 -0500
Committer: Dave Brondsema <dave@brondsema.net>
Committed: Tue Jan 17 13:54:16 2017 -0500

----------------------------------------------------------------------
 Allura/allura/model/repository.py | 11 ++++++-----
 ForgeSVN/forgesvn/model/svn.py    | 14 --------------
 2 files changed, 6 insertions(+), 19 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/allura/blob/ff370b65/Allura/allura/model/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py
index c5e8b2c..ba3773d 100644
--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -612,9 +612,11 @@ class Repository(Artifact, ActivityObject):
         if self.app.config.options.get('external_checkout_url', None):
             tpl = string.Template(self.app.config.options.external_checkout_url)
         else:
-            tpl = string.Template(
-                tg.config.get('scm.host.%s.%s' % (category, self.tool)))
-        return tpl.substitute(dict(username=username, path=self.url_path + self.name))
+            tpl = string.Template(tg.config.get('scm.host.%s.%s' % (category, self.tool)))
+        url = tpl.substitute(dict(username=username, path=self.url_path + self.name))
+        # this is an svn option, but keeps clone_*() code from diverging
+        url += c.app.config.options.get('checkout_url', '')
+        return url
 
     def clone_command(self, category, username=''):
         '''Return a string suitable for copy/paste that would clone this repo locally
@@ -625,8 +627,7 @@ class Repository(Artifact, ActivityObject):
         tpl = string.Template(tg.config.get('scm.clone.%s.%s' % (category, self.tool)) or
                               tg.config.get('scm.clone.%s' % self.tool))
         return tpl.substitute(dict(username=username,
-                                   source_url=self.clone_url(
-                                       category, username),
+                                   source_url=self.clone_url(category, username),
                                    dest_path=self.suggested_clone_dest_path()))
 
     def merge_requests_by_statuses(self, *statuses):

http://git-wip-us.apache.org/repos/asf/allura/blob/ff370b65/ForgeSVN/forgesvn/model/svn.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/model/svn.py b/ForgeSVN/forgesvn/model/svn.py
index 5d1f533..2a9c480 100644
--- a/ForgeSVN/forgesvn/model/svn.py
+++ b/ForgeSVN/forgesvn/model/svn.py
@@ -63,20 +63,6 @@ class Repository(M.Repository):
     def _impl(self):
         return SVNImplementation(self)
 
-    def clone_command(self, category, username=''):
-        '''Return a string suitable for copy/paste that would clone this repo locally
-           category is one of 'ro' (read-only), 'rw' (read/write), or 'https' (read/write
via https)
-        '''
-        if not username and c.user not in (None, User.anonymous()):
-            username = c.user.username
-        tpl = string.Template(tg.config.get('scm.clone.%s.%s' % (category, self.tool)) or
-                              tg.config.get('scm.clone.%s' % self.tool))
-        return tpl.substitute(dict(username=username,
-                                   source_url=self.clone_url(
-                                       category, username) + c.app.config.options.get(
-                                       'checkout_url'),
-                                   dest_path=self.suggested_clone_dest_path()))
-
     def latest(self, branch=None):
         if self._impl is None:
             return None


Mime
View raw message