changeset 643:9dc1d92d82ed beta

updated setup for all newest versions EmptyChangeset can take changeset as creation param.
author Marcin Kuzminski <marcin@python-works.com>
date Tue, 02 Nov 2010 22:26:50 +0100
parents 674ecf21de85
children c8bd0e6cc3da
files README.rst rhodecode/controllers/summary.py rhodecode/lib/helpers.py rhodecode/lib/middleware/simplegit.py rhodecode/lib/utils.py setup.py
diffstat 6 files changed, 31 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/README.rst	Tue Nov 02 22:24:55 2010 +0100
+++ b/README.rst	Tue Nov 02 22:26:50 2010 +0100
@@ -3,15 +3,14 @@
 =======================
 
 ``RhodeCode`` (formerly hg-app) is Pylons based repository management and 
-serving for mercurial_. It's similar to github or bitbucket, but it's suppose to run
-as standalone app, it's open source and focuses more on restricted access to repositories
-There's no default free access to RhodeCode You have to create an account in order
-to use the application. It's powered by vcs_ library that we created to handle
-many various version control systems.
+serving for mercurial_ and git_. It's similar to github or bitbucket, but 
+it's suppose to run as standalone app, it's open source and focuses more on 
+restricted access to repositories. There's no default free access to RhodeCode 
+You have to create an account in order to use the application. It's powered 
+by vcs_ library that we created to handle many various version control systems.
 
 RhodeCode uses `Semantic Versioning <http://semver.org/>`_
 
-
 RhodeCode demo
 --------------
 
--- a/rhodecode/controllers/summary.py	Tue Nov 02 22:24:55 2010 +0100
+++ b/rhodecode/controllers/summary.py	Tue Nov 02 22:26:50 2010 +0100
@@ -23,9 +23,10 @@
 @author: marcink
 """
 from pylons import tmpl_context as c, request, url
+from vcs.exceptions import ChangesetError
 from rhodecode.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
 from rhodecode.lib.base import BaseController, render
-from rhodecode.lib.utils import OrderedDict
+from rhodecode.lib.utils import OrderedDict, EmptyChangeset
 from rhodecode.model.hg import HgModel
 from rhodecode.model.db import Statistics
 from webhelpers.paginate import Page
@@ -70,11 +71,17 @@
         c.clone_repo_url = uri
         c.repo_tags = OrderedDict()
         for name, hash in c.repo_info.tags.items()[:10]:
-            c.repo_tags[name] = c.repo_info.get_changeset(hash)
+            try:
+                c.repo_tags[name] = c.repo_info.get_changeset(hash)
+            except ChangesetError:
+                c.repo_tags[name] = EmptyChangeset(hash)
 
         c.repo_branches = OrderedDict()
         for name, hash in c.repo_info.branches.items()[:10]:
-            c.repo_branches[name] = c.repo_info.get_changeset(hash)
+            try:
+                c.repo_branches[name] = c.repo_info.get_changeset(hash)
+            except ChangesetError:
+                c.repo_branches[name] = EmptyChangeset(hash)
 
         td = datetime.today() + timedelta(days=1)
         y, m, d = td.year, td.month, td.day
--- a/rhodecode/lib/helpers.py	Tue Nov 02 22:24:55 2010 +0100
+++ b/rhodecode/lib/helpers.py	Tue Nov 02 22:26:50 2010 +0100
@@ -328,8 +328,11 @@
 
 def _age(curdate):
     """turns a datetime into an age string."""
+    if not curdate:
+        return ''
 
     from datetime import timedelta, datetime
+
     agescales = [("year", 3600 * 24 * 365),
              ("month", 3600 * 24 * 30),
              #("week", 3600 * 24 * 7),
--- a/rhodecode/lib/middleware/simplegit.py	Tue Nov 02 22:24:55 2010 +0100
+++ b/rhodecode/lib/middleware/simplegit.py	Tue Nov 02 22:26:50 2010 +0100
@@ -151,7 +151,7 @@
             return HTTPNotFound()(environ, start_response)
         try:
             app = self.__make_app()
-        except Exception:
+        except:
             log.error(traceback.format_exc())
             return HTTPInternalServerError()(environ, start_response)
 
--- a/rhodecode/lib/utils.py	Tue Nov 02 22:24:55 2010 +0100
+++ b/rhodecode/lib/utils.py	Tue Nov 02 22:26:50 2010 +0100
@@ -296,13 +296,16 @@
 
 class EmptyChangeset(BaseChangeset):
     """
-    An dummy empty changeset.
+    An dummy empty changeset. It's possible to pass hash when creating
+    an EmptyChangeset
     """
 
-    revision = -1
-    message = ''
-    author = ''
-    date = ''
+    def __init__(self, cs='0' * 40):
+        self._empty_cs = cs
+        self.revision = -1
+        self.message = ''
+        self.author = ''
+        self.date = ''
 
     @LazyProperty
     def raw_id(self):
@@ -310,7 +313,7 @@
         Returns raw string identifying this changeset, useful for web
         representation.
         """
-        return '0' * 40
+        return self._empty_cs
 
     @LazyProperty
     def short_id(self):
--- a/setup.py	Tue Nov 02 22:24:55 2010 +0100
+++ b/setup.py	Tue Nov 02 22:26:50 2010 +0100
@@ -6,11 +6,11 @@
         "Pylons>=1.0.0",
         "SQLAlchemy>=0.6.4",
         "Mako>=0.3.5",
-        "vcs==0.1.10",
+        "vcs>=0.1.10",
         "pygments>=1.3.0",
         "mercurial==1.6.4",
-        "whoosh==1.1.1",
-        "celery==2.1.1",
+        "whoosh>=1.2.5",
+        "celery>=2.1.2",
         "py-bcrypt",
         "babel",
     ]