incubator-allura-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From john...@apache.org
Subject [7/8] git commit: [#2840] ticket:273 add raise exc.HTTPNotFound() to controllers and change filename of the tarball for svn and hg
Date Mon, 11 Mar 2013 23:07:10 GMT
[#2840] ticket:273 add raise exc.HTTPNotFound() to controllers and change  filename of the
tarball for svn and hg


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

Branch: refs/heads/master
Commit: 5d66090e9bebea6c34874cdb4bb9e6f6edf1716f
Parents: 584a9df
Author: Yuriy Arhipov <yuriyarhipovua@yandex.ru>
Authored: Mon Mar 4 15:46:22 2013 +0400
Committer: Cory Johns <johnsca@geek.net>
Committed: Mon Mar 11 22:29:45 2013 +0000

----------------------------------------------------------------------
 Allura/allura/controllers/repository.py |    6 +++---
 Allura/allura/model/repository.py       |   15 ++++++++-------
 Allura/development.ini                  |    2 +-
 ForgeGit/forgegit/model/git_repo.py     |    2 +-
 ForgeSVN/forgesvn/model/svn.py          |    2 +-
 5 files changed, 14 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5d66090e/Allura/allura/controllers/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/controllers/repository.py b/Allura/allura/controllers/repository.py
index 9c63a65..07b92ae 100644
--- a/Allura/allura/controllers/repository.py
+++ b/Allura/allura/controllers/repository.py
@@ -428,17 +428,17 @@ class CommitBrowser(BaseController):
     @expose('jinja:allura:templates/repo/tarball.html')
     def tarball(self, **kw):
         if not asbool(tg.config.get('scm.repos.tarball.enable', False)):
-            return
+            raise exc.HTTPNotFound()
         if (c.app.repo.get_tarball_status(self._revision) == 'ready'):
             redirect(c.app.repo.tarball_url(self._revision))
-        elif (c.app.repo.get_tarball_status(self._revision) == None):
+        elif (c.app.repo.get_tarball_status(self._revision) is None):
             allura.tasks.repo_tasks.tarball.post(revision=self._revision)
         return dict(commit=self._commit, revision=self._revision)
 
     @expose('json:')
     def tarball_status(self):
         if not asbool(tg.config.get('scm.repos.tarball.enable', False)):
-            return
+            raise exc.HTTPNotFound()
         return dict(status=c.app.repo.get_tarball_status(self._revision))
 
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5d66090e/Allura/allura/model/repository.py
----------------------------------------------------------------------
diff --git a/Allura/allura/model/repository.py b/Allura/allura/model/repository.py
index ce411a3..d509ceb 100644
--- a/Allura/allura/model/repository.py
+++ b/Allura/allura/model/repository.py
@@ -239,7 +239,7 @@ class Repository(Artifact, ActivityObject):
                             self.name)
 
     def tarball_url(self, revision):
-        shortname = c.app.repo.project.shortname
+        shortname = c.app.repo.project.shortname.replace('/', '-')
         mount_point = c.app.repo.app.config.options.mount_point
         filename = '%s-%s-%s.tar' % (shortname, mount_point, revision)
         r = os.path.join(self.tool,self.project.url()[1:],self.name,filename)
@@ -250,12 +250,13 @@ class Repository(Artifact, ActivityObject):
         return tarballs.get(revision)
 
     def set_tarball_status(self, revision, status):
-            for tarball in self.tarball_status:
-                if tarball['revision'] == revision:
-                    tarball['status'] = status
-                    return
-            self.tarball_status.append(dict(revision=revision, status=status))
-            session(self).flush(self)
+        for tarball in self.tarball_status:
+            if tarball['revision'] == revision:
+                tarball['status'] = status
+                session(self).flush(self)
+                return
+        self.tarball_status.append(dict(revision=revision, status=status))
+        session(self).flush(self)
 
     def __repr__(self): # pragma no cover
         return '<%s %s>' % (

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5d66090e/Allura/development.ini
----------------------------------------------------------------------
diff --git a/Allura/development.ini b/Allura/development.ini
index 10d9cec..3dc76d0 100644
--- a/Allura/development.ini
+++ b/Allura/development.ini
@@ -120,7 +120,7 @@ scm.new_refresh = true
 gitweb.cgi = /usr/lib/cgi-bin/gitweb.cgi
 
 scm.repos.root = /tmp
-scm.repos.tarball.enable = true
+scm.repos.tarball.enable = false
 scm.repos.tarball.root = /usr/share/nginx/www/
 scm.repos.tarball.url_prefix = http://localhost/
 

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5d66090e/ForgeGit/forgegit/model/git_repo.py
----------------------------------------------------------------------
diff --git a/ForgeGit/forgegit/model/git_repo.py b/ForgeGit/forgegit/model/git_repo.py
index 20b64c0..70c8050 100644
--- a/ForgeGit/forgegit/model/git_repo.py
+++ b/ForgeGit/forgegit/model/git_repo.py
@@ -323,7 +323,7 @@ class GitImplementation(M.RepositoryImplementation):
         return tree._id
 
     def tarball(self, commit):
-        shortname = self._repo.project.shortname.replace('/','-')
+        shortname = self._repo.project.shortname.replace('/', '-')
         mount_point = self._repo.app.config.options.mount_point
         if not os.path.exists(self._repo.tarball_path):
             os.makedirs(self._repo.tarball_path)

http://git-wip-us.apache.org/repos/asf/incubator-allura/blob/5d66090e/ForgeSVN/forgesvn/model/svn.py
----------------------------------------------------------------------
diff --git a/ForgeSVN/forgesvn/model/svn.py b/ForgeSVN/forgesvn/model/svn.py
index 41753ae..a3490bc 100644
--- a/ForgeSVN/forgesvn/model/svn.py
+++ b/ForgeSVN/forgesvn/model/svn.py
@@ -611,7 +611,7 @@ class SVNImplementation(M.RepositoryImplementation):
         return entries
 
     def tarball(self, commit):
-        shortname = self._repo.project.shortname
+        shortname = self._repo.project.shortname.replace('/', '-')
         mount_point = self._repo.app.config.options.mount_point
         if not os.path.exists(self._repo.tarball_path):
             os.makedirs(self._repo.tarball_path)


Mime
View raw message