changeset 811:bb35ad076e2f beta

docs updates
author Marcin Kuzminski <marcin@python-works.com>
date Sun, 05 Dec 2010 17:22:57 +0100
parents bd57d1cb9dc3
children 30ad41c76fae
files docs/api/index.rst docs/api/models.rst docs/changelog.rst docs/contributing.rst docs/enable_git.rst docs/images/screenshot1_main_page.png docs/index.rst docs/statistics.rst rhodecode/model/__init__.py rhodecode/model/permission.py rhodecode/model/repo.py rhodecode/model/scm.py rhodecode/model/user.py
diffstat 13 files changed, 182 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/api/index.rst	Sun Dec 05 17:22:57 2010 +0100
@@ -0,0 +1,10 @@
+.. _api:
+
+API Reference
+=============
+
+.. toctree::
+   :maxdepth: 3
+
+   models
+    
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/api/models.rst	Sun Dec 05 17:22:57 2010 +0100
@@ -0,0 +1,19 @@
+.. _models::
+
+The :mod:`models` Module
+========================
+
+.. automodule:: rhodecode.model
+   :members:
+   
+.. automodule:: rhodecode.model.permission
+   :members:
+  
+.. automodule:: rhodecode.model.repo
+   :members:   
+
+.. automodule:: rhodecode.model.scm
+   :members:
+
+.. automodule:: rhodecode.model.user
+   :members:      
\ No newline at end of file
--- a/docs/changelog.rst	Sun Dec 05 15:47:49 2010 +0100
+++ b/docs/changelog.rst	Sun Dec 05 17:22:57 2010 +0100
@@ -18,6 +18,7 @@
 - anonymous access, authentication via ldap
 - performance upgrade for cached repos list - each repository has it's own 
   cache that's invalidated when needed.
+- performance upgrades on repositories with large amount of commits (20K+)
 - main page quick filter for filtering repositories
 - user dashboards with ability to follow chosen repositories actions
 - sends email to admin on new user registration
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/contributing.rst	Sun Dec 05 17:22:57 2010 +0100
@@ -0,0 +1,9 @@
+.. _contributing:
+
+Contributing in RhodeCode
+=========================
+
+If You would like to contribute to RhodeCode, please contact me, any help is
+greatly appreciated.
+
+Thank You.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/enable_git.rst	Sun Dec 05 17:22:57 2010 +0100
@@ -0,0 +1,21 @@
+.. _enable_git:
+
+Enabling GIT support (beta)
+===========================
+
+
+Git support in RhodeCode 1.1 was disabled due to some instability issues, but
+If You would like to test it fell free to re-enable it. To enable GIT just
+uncomment git line in rhodecode/__init__.py file
+
+.. code-block:: python
+ 
+   BACKENDS = {
+       'hg': 'Mercurial repository',
+       #'git': 'Git repository',
+   }
+
+.. note::
+   Please note that it's not fully stable and it might crash (that's why it 
+   was disabled), so be carefull about enabling git support. Don't use it in 
+   production !
\ No newline at end of file
Binary file docs/images/screenshot1_main_page.png has changed
--- a/docs/index.rst	Sun Dec 05 15:47:49 2010 +0100
+++ b/docs/index.rst	Sun Dec 05 17:22:57 2010 +0100
@@ -13,8 +13,31 @@
    installation
    setup
    upgrade
+   
+**Usage**
+
+.. toctree::
+   :maxdepth: 1
+
+   enable_git
+   statistics
+   
+**Develop**
+
+.. toctree::
+   :maxdepth: 1
+   
+   contributing
    changelog
 
+**API**
+
+.. toctree::
+   :maxdepth: 2
+
+   api/index
+   
+
 Other topics
 ------------
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/docs/statistics.rst	Sun Dec 05 17:22:57 2010 +0100
@@ -0,0 +1,32 @@
+.. _statistics:
+
+
+Statistics
+==========
+
+RhodeCode statistics system is heavy on resources, so in order to keep a 
+balance between the usability and performance statistics are cached inside db
+and are gathered incrementally, this is how RhodeCode does this:
+
+With Celery disabled
+++++++++++++++++++++
+
+- on each first visit on summary page a set of 250 commits are parsed and
+  updates statistics cache
+- this happens on each single visit of statistics page until all commits are
+  fetched. Statistics are kept cached until some more commits are added to
+  repository, in such case RhodeCode will fetch only the ones added and will
+  update it's cache.
+
+
+With Celery enabled
++++++++++++++++++++
+
+- on first visit on summary page RhodeCode will create task that will execute
+  on celery workers, that will gather all stats until all commits are parsed,
+  each task will parse 250 commits, and run next task to parse next 250 
+  commits, until all are parsed.
+
+.. note::
+   In any time You can disable statistics on each repository in repository edit
+   form in admin panel, just uncheck the statistics checkbox.
\ No newline at end of file
--- a/rhodecode/model/__init__.py	Sun Dec 05 15:47:49 2010 +0100
+++ b/rhodecode/model/__init__.py	Sun Dec 05 17:22:57 2010 +0100
@@ -1,7 +1,8 @@
 # -*- coding: utf-8 -*-
 """
-    package.rhodecode.model.__init__
-    ~~~~~~~~~~~~~~
+    rhodecode.model.__init__
+    ~~~~~~~~~~~~~~~~~~~~~~~~
+    
     The application's model objects
     
     :created_on: Nov 25, 2010
@@ -11,17 +12,20 @@
     
     
     :example:
-        from paste.deploy import appconfig
-        from pylons import config
-        from sqlalchemy import engine_from_config
-        from rhodecode.config.environment import load_environment
-        
-        conf = appconfig('config:development.ini', relative_to = './../../')
-        load_environment(conf.global_conf, conf.local_conf)
-        
-        engine = engine_from_config(config, 'sqlalchemy.')
-        init_model(engine)
-        #RUN YOUR CODE HERE    
+    
+        .. code-block:: python
+    
+           from paste.deploy import appconfig
+           from pylons import config
+           from sqlalchemy import engine_from_config
+           from rhodecode.config.environment import load_environment
+           
+           conf = appconfig('config:development.ini', relative_to = './../../')
+           load_environment(conf.global_conf, conf.local_conf)
+           
+           engine = engine_from_config(config, 'sqlalchemy.')
+           init_model(engine)
+           # RUN YOUR CODE HERE
     
 """
 # This program is free software; you can redistribute it and/or
@@ -44,11 +48,21 @@
 log = logging.getLogger(__name__)
 
 def init_model(engine):
-    """Call me before using any of the tables or classes in the model"""
+    """Initializes db session, bind the engine with the metadata,
+    Call this before using any of the tables or classes in the model, preferably
+    once in application start
+    
+    :param engine: engine to bind to
+    """
     log.info("initializing db models for %s", engine)
     meta.Base.metadata.bind = engine
 
 class BaseModel(object):
+    """Base Model for all RhodeCode models, it adds sql alchemy session
+    into instance of model
+    
+    :param sa: If passed it reuses this session instead of creating a new one
+    """
 
     def __init__(self, sa=None):
         if sa is not None:
--- a/rhodecode/model/permission.py	Sun Dec 05 15:47:49 2010 +0100
+++ b/rhodecode/model/permission.py	Sun Dec 05 17:22:57 2010 +0100
@@ -1,9 +1,10 @@
 # -*- coding: utf-8 -*-
 """
-    package.rhodecode.model.permission
-    ~~~~~~~~~~~~~~
+    rhodecode.model.permission
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~
 
     permissions model for RhodeCode
+    
     :created_on: Aug 20, 2010
     :author: marcink
     :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>    
@@ -37,8 +38,15 @@
 
 
 class PermissionModel(BaseModel):
+    """Permissions model for RhodeCode
+    """
 
     def get_permission(self, permission_id, cache=False):
+        """Get's permissions by id
+        
+        :param permission_id: id of permission to get from database
+        :param cache: use Cache for this query
+        """
         perm = self.sa.query(Permission)
         if cache:
             perm = perm.options(FromCache("sql_cache_short",
@@ -46,6 +54,11 @@
         return perm.get(permission_id)
 
     def get_permission_by_name(self, name, cache=False):
+        """Get's permissions by given name
+        
+        :param name: name to fetch
+        :param cache: Use cache for this query
+        """
         perm = self.sa.query(Permission)\
             .filter(Permission.permission_name == name)
         if cache:
--- a/rhodecode/model/repo.py	Sun Dec 05 15:47:49 2010 +0100
+++ b/rhodecode/model/repo.py	Sun Dec 05 17:22:57 2010 +0100
@@ -1,7 +1,7 @@
 # -*- coding: utf-8 -*-
 """
-    package.rhodecode.model.repo
-    ~~~~~~~~~~~~~~
+    rhodecode.model.repo
+    ~~~~~~~~~~~~~~~~~~~~
 
     Repository model for rhodecode
     
--- a/rhodecode/model/scm.py	Sun Dec 05 15:47:49 2010 +0100
+++ b/rhodecode/model/scm.py	Sun Dec 05 17:22:57 2010 +0100
@@ -1,9 +1,10 @@
 # -*- coding: utf-8 -*-
 """
-    package.rhodecode.model.scm
-    ~~~~~~~~~~~~~~
+    rhodecode.model.scm
+    ~~~~~~~~~~~~~~~~~~~
 
-    scm model for RhodeCode 
+    Scm model for RhodeCode
+
     :created_on: Apr 9, 2010
     :author: marcink
     :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>    
@@ -23,7 +24,6 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 # MA  02110-1301, USA.
-
 import os
 import time
 import traceback
@@ -64,27 +64,26 @@
         self.repo_id = repo_id
 
 class ScmModel(BaseModel):
-    """
-    Mercurial Model
+    """Generic Scm Model
     """
 
     @LazyProperty
     def repos_path(self):
+        """Get's the repositories root path from database
         """
-        Get's the repositories root path from database
-        """
+
         q = self.sa.query(RhodeCodeUi).filter(RhodeCodeUi.ui_key == '/').one()
 
         return q.ui_value
 
     def repo_scan(self, repos_path, baseui):
-        """
-        Listing of repositories in given path. This path should not be a 
+        """Listing of repositories in given path. This path should not be a 
         repository itself. Return a dictionary of repository objects
         
         :param repos_path: path to directory containing repositories
         :param baseui
         """
+
         log.info('scanning for repositories in %s', repos_path)
 
         if not isinstance(baseui, ui.ui):
@@ -111,12 +110,12 @@
         return repos_list
 
     def get_repos(self, all_repos=None):
-        """
-        Get all repos from db and for each repo create it's backend instance.
+        """Get all repos from db and for each repo create it's backend instance.
         and fill that backed with information from database
         
         :param all_repos: give specific repositories list, good for filtering
         """
+
         if all_repos is None:
             all_repos = self.sa.query(Repository)\
                 .order_by(Repository.repo_name).all()
@@ -156,8 +155,7 @@
         return self.get(repo_name)
 
     def get(self, repo_name, invalidation_list=None):
-        """
-        Get's repository from given name, creates BackendInstance and
+        """Get's repository from given name, creates BackendInstance and
         propagates it's data from database with all additional information
         
         :param repo_name:
@@ -228,12 +226,12 @@
 
 
     def mark_for_invalidation(self, repo_name):
-        """
-        Puts cache invalidation task into db for 
+        """Puts cache invalidation task into db for 
         further global cache invalidation
         
         :param repo_name: this repo that should invalidation take place
         """
+
         log.debug('marking %s for invalidation', repo_name)
         cache = self.sa.query(CacheInvalidation)\
             .filter(CacheInvalidation.cache_key == repo_name).scalar()
@@ -347,8 +345,8 @@
 
 
     def _should_invalidate(self, repo_name):
-        """
-        Looks up database for invalidation signals for this repo_name
+        """Looks up database for invalidation signals for this repo_name
+        
         :param repo_name:
         """
 
@@ -362,10 +360,11 @@
         return ret
 
     def _mark_invalidated(self, cache_key):
+        """ Marks all occurences of cache to invaldation as already invalidated
+        
+        :param cache_key:
         """
-        Marks all occurences of cache to invaldation as already invalidated
-        :param repo_name:
-        """
+
         if cache_key:
             log.debug('marking %s as already invalidated', cache_key)
         try:
--- a/rhodecode/model/user.py	Sun Dec 05 15:47:49 2010 +0100
+++ b/rhodecode/model/user.py	Sun Dec 05 17:22:57 2010 +0100
@@ -1,9 +1,10 @@
 # -*- coding: utf-8 -*-
 """
     package.rhodecode.model.user
-    ~~~~~~~~~~~~~~
+    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
     users model for RhodeCode
+    
     :created_on: Apr 9, 2010
     :author: marcink
     :copyright: (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>