Changeset - bee56f209c40
[Not reviewed]
Marcin Kuzminski - 15 years ago 2010-11-10 01:14:44
marcin@python-works.com
fixes few bugs
- fixed #53 python2.5 incompatible enumerate calls
- fixed #52 disable mercurial extension for web
- fixed #51 deleting repositories don't delete it's dependent objects
- small css updated
10 files changed with 113 insertions and 80 deletions:
0 comments (0 inline, 0 general)
docs/changelog.rst
Show inline comments
 
.. _changelog:
 

	
 
Changelog
 
=========
 

	
 

	
 
1.0.1 (**2010-11-10**)
 
----------------------
 

	
 
- fixed #53 python2.5 incompatible enumerate calls
 
- fixed #52 disable mercurial extension for web
 
- fixed #51 deleting repositories don't delete it's dependent objects
 
- small css updated
 

	
 

	
 
1.0.0 (**2010-11-02**)
 
----------------------
 

	
 
- security bugfix simplehg wasn't checking for permissions on commands
 
  other than pull or push.
 
- fixed doubled messages after push or pull in admin journal
 
- templating and css corrections, fixed repo switcher on chrome, updated titles
 
- admin menu accessible from options menu on repository view
 
- permissions cached queries
 

	
 
1.0.0rc4  (**2010-10-12**)
 
--------------------------
 

	
 
- fixed python2.5 missing simplejson imports (thanks to Jens Bäckman)
 
- removed cache_manager settings from sqlalchemy meta
 
- added sqlalchemy cache settings to ini files
 
- validated password length and added second try of failure on paster setup-app
 
- fixed setup database destroy prompt even when there was no db
 

	
 

	
 
1.0.0rc3 (**2010-10-11**)
 
-------------------------
 

	
 
- fixed i18n during installation.
 

	
 
1.0.0rc2 (**2010-10-11**)
 
-------------------------
 

	
 
- Disabled dirsize in file browser, it's causing nasty bug when dir renames 
 
  occure. After vcs is fixed it'll be put back again.
 
- templating/css rewrites, optimized css.
docs/installation.rst
Show inline comments
 
.. _installation:
 

	
 
Installation
 
============
 

	
 
``RhodeCode`` is written entirely in Python, but in order to use it's full
 
potential there are some third-party requirements. When RhodeCode is used 
 
together with celery You have to install some kind of message broker,
 
together with celery_ You have to install some kind of message broker,
 
recommended one is rabbitmq_ to make the async tasks work.
 

	
 
Of course RhodeCode works in sync mode also, then You don't have to install
 
any third party apps. Celery_ will give You large speed improvement when using
 
many big repositories. If You plan to use it for 2 or 3 small repositories, it
 
many big repositories. If You plan to use it for 5 or 10 small repositories, it
 
will work just fine without celery running.
 
   
 
After You decide to Run it with celery make sure You run celeryd and
 
message broker together with the application.   
 

	
 
Requirements for Celery
 
-----------------------
 

	
 
**Message Broker** 
 

	
 
- preferred is `RabbitMq <http://www.rabbitmq.com/>`_
 
- possible other is `Redis <http://code.google.com/p/redis/>`_
 

	
 
For installation instructions You can visit: 
 
http://ask.github.com/celery/getting-started/index.html
 
It's very nice tutorial how to start celery_ with rabbitmq_
 

	
 
Install from Cheese Shop
 
------------------------
 

	
 
Easiest way to install ``rhodecode`` is to run::
 

	
 
   easy_install rhodecode
 
 easy_install rhodecode
 

	
 
Or::
 

	
 
 pip install rhodecode
 

	
 
If you prefer to install manually simply grab latest release from
 
http://pypi.python.org/pypi/rhodecode, decompres archive and run::
 

	
 
   python setup.py install
 
 python setup.py install
 

	
 

	
 
Step by step installation example
 
---------------------------------
 

	
 

	
 
- Assuming You have installed virtualenv_ create one using. The `--no-site-packages`
 
  will make sure non of Your system libs are linked with this virtualenv_  
 
- Assuming You have installed virtualenv_ create one using. 
 
  The `--no-site-packages` will make sure non of Your system libs are linked 
 
  with this virtualenv_  
 

	
 
::
 

	
 
 virtualenv --no-site-packages /var/www/rhodecode-venv
 

	
 
- this will install new virtualenv_ into `/var/www/rhodecode-venv`. 
 
- Activate the virtualenv_ by running 
 

	
 
::
 

	
 
  source activate /var/www/rhodecode-venv/bin/activate
 
     
 
- Make a folder for rhodecode somewhere on the filesystem for example 
 

	
 
::
 

	
 
  mkdir /var/www/rhodecode
 
  
 
    
 
- Run this command to install rhodecode
 

	
 
::
 

	
 
  easy_install rhodecode 
 

	
 
- this will install rhodecode together with pylons
 
  and all other required python libraries
 

	
 

	
 
You can now proceed to :ref:`setup`
 

	
 
.. _virtualenv: http://pypi.python.org/pypi/virtualenv  
 
.. _python: http://www.python.org/
 
.. _mercurial: http://mercurial.selenic.com/
 
.. _celery: http://celeryproject.org/
 
.. _rabbitmq: http://www.rabbitmq.com/
 
\ No newline at end of file
docs/setup.rst
Show inline comments
 
.. _setup:
 

	
 
Setup
 
=====
 

	
 

	
 
Setting up the application
 
--------------------------
 

	
 
::
 
 
 
 paster make-config RhodeCode production.ini
 

	
 
- This will create `production.ini` config inside the directory
 
  this config contain various settings for rhodecode, e.g port, email settings
 
  static files, cache and logging.
 

	
 
::
 

	
 
 paster setup-app production.ini
 

	
 
- This command will create all needed tables and an admin account. 
 
  When asked for a path You can either use a new location of one with already 
 
  existing ones. RhodeCode will simply add all new found repositories to 
 
  it's database. Also make sure You specify correct path to repositories.
 
- Remember that the given path for mercurial_ repositories must be write 
 
  accessible for the application. It's very important since RhodeCode web interface
 
  will work even without such an access but, when trying to do a push it'll 
 
  eventually fail with permission denied errors. 
 
- Run 
 

	
 
::
 
 
 
 paster serve production.ini
 
 
 
- This command runs the rhodecode server the app should be available at the 
 
  127.0.0.1:5000. This ip and port is configurable via the production.ini 
 
  file  created in previous step
 
- Use admin account you created to login.
 
- Default permissions on each repository is read, and owner is admin. So 
 
  remember to update these if needed.
 
  
 
Note
 
----
 

	
 
RhodeCode when running without the celery it's running all it's task in sync
 
mode, for first few times when visiting summary page You can notice few
 
slow downs, this is due the statistics building it's cache. After all changesets
 
are parsed it'll take the stats from cache and run much faster. Each summary
 
page display parse at most 250 changesets in order to not stress the cpu, so
 
the full stats are going to be loaded after total_number_of_changesets/250
 
summary page visits.
 

	
 

	
 
    
 
Setting up Whoosh
 
-----------------
 

	
 
- For full text search You can either put crontab entry for
 

	
 
::
 
 
 
 python /var/www/rhodecode/<rhodecode_installation_path>/lib/indexers/daemon.py incremental <put_here_path_to_repos>
 
  
 
When using incremental mode whoosh will check last modification date of each file
 
and add it to reindex if newer file is available. Also indexing daemon checks
 
for removed files and removes them from index. Sometime You might want to rebuild
 
index from scrach, in admin pannel You can check `build from scratch` flag
 
index from scratch, in admin panel You can check `build from scratch` flag
 
and in standalone daemon You can pass `full` instead on incremental to build
 
remove previos index and build new one.
 
remove previous index and build new one.
 

	
 
Nginx virtual host example
 
--------------------------
 

	
 
Sample config for nginx::
 

	
 
 server {
 
    listen          80;
 
    server_name     hg.myserver.com;
 
    access_log      /var/log/nginx/rhodecode.access.log;
 
    error_log       /var/log/nginx/rhodecode.error.log;
 
    location / {
 
            root /var/www/rhodecode/rhodecode/public/;
 
            if (!-f $request_filename){
 
                proxy_pass      http://127.0.0.1:5000;
 
            }
 
            #this is important for https !!!
 
            proxy_set_header X-Url-Scheme $scheme;
 
            include         /etc/nginx/proxy.conf;  
 
    }
 
 }  
 
  
 
Here's the proxy.conf. It's tuned so it'll not timeout on long
 
pushes and also on large pushes::
 

	
 
    proxy_redirect              off;
 
    proxy_set_header            Host $host;
 
    proxy_set_header            X-Host $http_host;
 
    proxy_set_header            X-Real-IP $remote_addr;
 
    proxy_set_header            X-Forwarded-For $proxy_add_x_forwarded_for;
 
    proxy_set_header            Proxy-host $proxy_host;
 
    client_max_body_size        400m;
 
    client_body_buffer_size     128k;
 
    proxy_buffering             off;
 
    proxy_connect_timeout       3600;
 
    proxy_send_timeout          3600;
 
    proxy_read_timeout          3600;
 
    proxy_buffer_size           8k;
 
    proxy_buffers               8 32k;
 
    proxy_busy_buffers_size     64k;
 
    proxy_temp_file_write_size  64k;
 
 
 
Also when using root path with nginx You might set the static files to false
 
in production.ini file::
 

	
 
  [app:main]
 
    use = egg:rhodecode
 
    full_stack = true
rhodecode/__init__.py
Show inline comments
 
#!/usr/bin/env python
 
# encoding: utf-8
 
# RhodeCode, a web based repository management based on pylons
 
# Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com>
 
# 
 
# This program is free software; you can redistribute it and/or
 
# modify it under the terms of the GNU General Public License
 
# as published by the Free Software Foundation; version 2
 
# of the License or (at your opinion) any later version of the license.
 
# 
 
# This program is distributed in the hope that it will be useful,
 
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
# GNU General Public License for more details.
 
# 
 
# You should have received a copy of the GNU General Public License
 
# along with this program; if not, write to the Free Software
 
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
 
# MA  02110-1301, USA.
 
"""
 
Created on April 9, 2010
 
RhodeCode, a web based repository management based on pylons
 
versioning implementation: http://semver.org/
 
@author: marcink
 
"""
 

	
 
VERSION = (1, 0, 0,)
 
VERSION = (1, 0, 1,)
 

	
 
__version__ = '.'.join((str(each) for each in VERSION[:4]))
 

	
 
def get_version():
 
    """
 
    Returns shorter version (digit parts only) as string.
 
    """
 
    return '.'.join((str(each) for each in VERSION[:3]))
rhodecode/lib/helpers.py
Show inline comments
 
@@ -19,118 +19,118 @@ from webhelpers.html.tools import auto_l
 
    mail_to, strip_links, strip_tags, tag_re
 
from webhelpers.number import format_byte_size, format_bit_size
 
from webhelpers.pylonslib import Flash as _Flash
 
from webhelpers.pylonslib.secure_form import secure_form
 
from webhelpers.text import chop_at, collapse, convert_accented_entities, \
 
    convert_misc_entities, lchop, plural, rchop, remove_formatting, \
 
    replace_whitespace, urlify, truncate, wrap_paragraphs
 

	
 
#Custom helpers here :)
 
class _Link(object):
 
    '''
 
    Make a url based on label and url with help of url_for
 
    :param label:name of link    if not defined url is used
 
    :param url: the url for link
 
    '''
 

	
 
    def __call__(self, label='', *url_, **urlargs):
 
        if label is None or '':
 
            label = url
 
        link_fn = link_to(label, url(*url_, **urlargs))
 
        return link_fn
 

	
 
link = _Link()
 

	
 
class _GetError(object):
 

	
 
    def __call__(self, field_name, form_errors):
 
        tmpl = """<span class="error_msg">%s</span>"""
 
        if form_errors and form_errors.has_key(field_name):
 
            return literal(tmpl % form_errors.get(field_name))
 

	
 
get_error = _GetError()
 

	
 
def recursive_replace(str, replace=' '):
 
    """
 
    Recursive replace of given sign to just one instance
 
    :param str: given string
 
    :param replace:char to find and replace multiple instances
 
        
 
    Examples::
 
    >>> recursive_replace("Mighty---Mighty-Bo--sstones",'-')
 
    'Mighty-Mighty-Bo-sstones'
 
    """
 

	
 
    if str.find(replace * 2) == -1:
 
        return str
 
    else:
 
        str = str.replace(replace * 2, replace)
 
        return recursive_replace(str, replace)  
 
        return recursive_replace(str, replace)
 

	
 
class _ToolTip(object):
 
    
 

	
 
    def __call__(self, tooltip_title, trim_at=50):
 
        """
 
        Special function just to wrap our text into nice formatted autowrapped
 
        text
 
        :param tooltip_title:
 
        """
 
        
 

	
 
        return wrap_paragraphs(escape(tooltip_title), trim_at)\
 
                       .replace('\n', '<br/>')
 
    
 

	
 
    def activate(self):
 
        """
 
        Adds tooltip mechanism to the given Html all tooltips have to have 
 
        set class tooltip and set attribute tooltip_title.
 
        Then a tooltip will be generated based on that
 
        All with yui js tooltip
 
        """
 
        
 

	
 
        js = '''
 
        YAHOO.util.Event.onDOMReady(function(){
 
            function toolTipsId(){
 
                var ids = [];
 
                var tts = YAHOO.util.Dom.getElementsByClassName('tooltip');
 
                
 
                for (var i = 0; i < tts.length; i++) {
 
                    //if element doesn not have and id autgenerate one for tooltip
 
                    
 
                    if (!tts[i].id){
 
                        tts[i].id='tt'+i*100;
 
                    }
 
                    ids.push(tts[i].id);
 
                }
 
                return ids        
 
            };
 
            var myToolTips = new YAHOO.widget.Tooltip("tooltip", { 
 
                context: toolTipsId(),
 
                monitorresize:false,
 
                xyoffset :[0,0],
 
                autodismissdelay:300000,
 
                hidedelay:5,
 
                showdelay:20,
 
            });
 
            
 
            //Mouse Over event disabled for new repositories since they dont
 
            //have last commit message
 
            myToolTips.contextMouseOverEvent.subscribe(
 
                function(type, args) {
 
                    var context = args[0];
 
                    var txt = context.getAttribute('tooltip_title');
 
                    if(txt){                                       
 
                        return true;
 
                    }
 
                    else{
 
                        return false;
 
                    }
 
                });
 
            
 
                            
 
            // Set the text for the tooltip just before we display it. Lazy method
 
            myToolTips.contextTriggerEvent.subscribe( 
 
                 function(type, args) { 
 

	
 
                 
 
                        var context = args[0]; 
 
                        
 
                        var txt = context.getAttribute('tooltip_title');
 
@@ -145,239 +145,239 @@ class _ToolTip(object):
 
                        var context_h = context.offsetHeight;
 
                        
 
                        var pos_x = YAHOO.util.Dom.getX(context);
 
                        var pos_y = YAHOO.util.Dom.getY(context);
 

	
 
                        var display_strategy = 'top';
 
                        var xy_pos = [0,0];
 
                        switch (display_strategy){
 
                        
 
                            case 'top':
 
                                var cur_x = (pos_x+context_w/2)-(tt_w/2);
 
                                var cur_y = pos_y-tt_h-4;
 
                                xy_pos = [cur_x,cur_y];                                
 
                                break;
 
                            case 'bottom':
 
                                var cur_x = (pos_x+context_w/2)-(tt_w/2);
 
                                var cur_y = pos_y+context_h+4;
 
                                xy_pos = [cur_x,cur_y];                                
 
                                break;
 
                            case 'left':
 
                                var cur_x = (pos_x-tt_w-4);
 
                                var cur_y = pos_y-((tt_h/2)-context_h/2);
 
                                xy_pos = [cur_x,cur_y];                                
 
                                break;
 
                            case 'right':
 
                                var cur_x = (pos_x+context_w+4);
 
                                var cur_y = pos_y-((tt_h/2)-context_h/2);
 
                                xy_pos = [cur_x,cur_y];                                
 
                                break;
 
                             default:
 
                                var cur_x = (pos_x+context_w/2)-(tt_w/2);
 
                                var cur_y = pos_y-tt_h-4;
 
                                xy_pos = [cur_x,cur_y];                                
 
                                break;                             
 
                                 
 
                        }
 

	
 
                        this.cfg.setProperty("xy",xy_pos);
 

	
 
                  });
 
                  
 
            //Mouse out 
 
            myToolTips.contextMouseOutEvent.subscribe(
 
                function(type, args) {
 
                    var context = args[0];
 
                    
 
                });
 
        });
 
        '''         
 
        '''
 
        return literal(js)
 

	
 
tooltip = _ToolTip()
 

	
 
class _FilesBreadCrumbs(object):
 
    
 

	
 
    def __call__(self, repo_name, rev, paths):
 
        url_l = [link_to(repo_name, url('files_home',
 
                                        repo_name=repo_name,
 
                                        revision=rev, f_path=''))]
 
        paths_l = paths.split('/')
 
        
 
        for cnt, p in enumerate(paths_l, 1):
 

	
 
        for cnt, p in enumerate(paths_l):
 
            if p != '':
 
                url_l.append(link_to(p, url('files_home',
 
                                            repo_name=repo_name,
 
                                            revision=rev,
 
                                            f_path='/'.join(paths_l[:cnt]))))
 
                                            f_path='/'.join(paths_l[:cnt + 1]))))
 

	
 
        return literal('/'.join(url_l))
 

	
 
files_breadcrumbs = _FilesBreadCrumbs()
 
class CodeHtmlFormatter(HtmlFormatter):
 

	
 
    def wrap(self, source, outfile):
 
        return self._wrap_div(self._wrap_pre(self._wrap_code(source)))
 

	
 
    def _wrap_code(self, source):
 
        for cnt, it in enumerate(source, 1):
 
        for cnt, it in enumerate(source):
 
            i, t = it
 
            t = '<div id="#S-%s">%s</div>' % (cnt, t)
 
            t = '<div id="#S-%s">%s</div>' % (cnt + 1, t)
 
            yield i, t
 
def pygmentize(filenode, **kwargs):
 
    """
 
    pygmentize function using pygments
 
    :param filenode:
 
    """
 
    return literal(code_highlight(filenode.content,
 
                                  filenode.lexer, CodeHtmlFormatter(**kwargs)))
 

	
 
def pygmentize_annotation(filenode, **kwargs):
 
    """
 
    pygmentize function for annotation
 
    :param filenode:
 
    """
 
    
 

	
 
    color_dict = {}
 
    def gen_color():
 
        """generator for getting 10k of evenly distibuted colors using hsv color
 
        and golden ratio.
 
        """        
 
        """
 
        import colorsys
 
        n = 10000
 
        golden_ratio = 0.618033988749895
 
        h = 0.22717784590367374
 
        #generate 10k nice web friendly colors in the same order
 
        for c in xrange(n):
 
            h += golden_ratio
 
            h %= 1
 
            HSV_tuple = [h, 0.95, 0.95]
 
            RGB_tuple = colorsys.hsv_to_rgb(*HSV_tuple)
 
            yield map(lambda x:str(int(x * 256)), RGB_tuple)           
 
            yield map(lambda x:str(int(x * 256)), RGB_tuple)
 

	
 
    cgenerator = gen_color()
 
        
 

	
 
    def get_color_string(cs):
 
        if color_dict.has_key(cs):
 
            col = color_dict[cs]
 
        else:
 
            col = color_dict[cs] = cgenerator.next()
 
        return "color: rgb(%s)! important;" % (', '.join(col))
 
        
 

	
 
    def url_func(changeset):
 
        tooltip_html = "<div style='font-size:0.8em'><b>Author:</b>" + \
 
        " %s<br/><b>Date:</b> %s</b><br/><b>Message:</b> %s<br/></div>" 
 
        
 
        " %s<br/><b>Date:</b> %s</b><br/><b>Message:</b> %s<br/></div>"
 

	
 
        tooltip_html = tooltip_html % (changeset.author,
 
                                               changeset.date,
 
                                               tooltip(changeset.message))
 
        lnk_format = 'r%-5s:%s' % (changeset.revision,
 
                                 changeset.short_id)
 
        uri = link_to(
 
                lnk_format,
 
                url('changeset_home', repo_name=changeset.repository.name,
 
                    revision=changeset.short_id),
 
                style=get_color_string(changeset.short_id),
 
                class_='tooltip',
 
                tooltip_title=tooltip_html
 
              )
 
        
 

	
 
        uri += '\n'
 
        return uri   
 
        return uri
 
    return literal(annotate_highlight(filenode, url_func, **kwargs))
 
      
 

	
 
def repo_name_slug(value):
 
    """Return slug of name of repository
 
    This function is called on each creation/modification
 
    of repository to prevent bad names in repo
 
    """
 
    slug = remove_formatting(value)
 
    slug = strip_tags(slug)
 
    
 

	
 
    for c in """=[]\;'"<>,/~!@#$%^&*()+{}|: """:
 
        slug = slug.replace(c, '-')
 
    slug = recursive_replace(slug, '-')
 
    slug = collapse(slug, '-')
 
    return slug
 

	
 
def get_changeset_safe(repo, rev):
 
    from vcs.backends.base import BaseRepository
 
    from vcs.exceptions import RepositoryError
 
    if not isinstance(repo, BaseRepository):
 
        raise Exception('You must pass an Repository '
 
                        'object as first argument got %s', type(repo))
 
        
 

	
 
    try:
 
        cs = repo.get_changeset(rev)
 
    except RepositoryError:
 
        from rhodecode.lib.utils import EmptyChangeset
 
        cs = EmptyChangeset()
 
    return cs
 

	
 

	
 
flash = _Flash()
 

	
 

	
 
#===============================================================================
 
# MERCURIAL FILTERS available via h.
 
#===============================================================================
 
from mercurial import util
 
from mercurial.templatefilters import age as _age, person as _person
 

	
 
age = lambda  x:_age(x)
 
capitalize = lambda x: x.capitalize()
 
date = lambda x: util.datestr(x)
 
email = util.email
 
email_or_none = lambda x: util.email(x) if util.email(x) != x else None
 
person = lambda x: _person(x)
 
hgdate = lambda  x: "%d %d" % x
 
isodate = lambda  x: util.datestr(x, '%Y-%m-%d %H:%M %1%2')
 
isodatesec = lambda  x: util.datestr(x, '%Y-%m-%d %H:%M:%S %1%2')
 
localdate = lambda  x: (x[0], util.makedate()[1])
 
rfc822date = lambda  x: util.datestr(x, "%a, %d %b %Y %H:%M:%S %1%2")
 
rfc822date_notz = lambda  x: util.datestr(x, "%a, %d %b %Y %H:%M:%S")
 
rfc3339date = lambda  x: util.datestr(x, "%Y-%m-%dT%H:%M:%S%1:%2")
 
time_ago = lambda x: util.datestr(_age(x), "%a, %d %b %Y %H:%M:%S %1%2")
 

	
 

	
 
#===============================================================================
 
# PERMS
 
#===============================================================================
 
from rhodecode.lib.auth import HasPermissionAny, HasPermissionAll, \
 
HasRepoPermissionAny, HasRepoPermissionAll
 

	
 
#===============================================================================
 
# GRAVATAR URL
 
#===============================================================================
 
import hashlib
 
import urllib
 
from pylons import request
 

	
 
def gravatar_url(email_address, size=30):
 
    ssl_enabled = 'https' == request.environ.get('HTTP_X_URL_SCHEME')
 
    default = 'identicon'
 
    baseurl_nossl = "http://www.gravatar.com/avatar/"
 
    baseurl_ssl = "https://secure.gravatar.com/avatar/"
 
    baseurl = baseurl_ssl if ssl_enabled else baseurl_nossl
 
        
 
    
 

	
 

	
 
    # construct the url
 
    gravatar_url = baseurl + hashlib.md5(email_address.lower()).hexdigest() + "?"
 
    gravatar_url += urllib.urlencode({'d':default, 's':str(size)})
 

	
 
    return gravatar_url
 

	
 
def safe_unicode(str):
 
    """safe unicode function. In case of UnicodeDecode error we try to return
 
    unicode with errors replace, if this failes we return unicode with 
 
    string_escape decoding """
 
    
 

	
 
    try:
 
        u_str = unicode(str)
 
    except UnicodeDecodeError:
 
        try:
 
            u_str = unicode(str, 'utf-8', 'replace')
 
        except UnicodeDecodeError:
 
            #incase we have a decode error just represent as byte string
 
            u_str = unicode(str(str).encode('string_escape'))
 
        
 

	
 
    return u_str
rhodecode/lib/utils.py
Show inline comments
 
@@ -176,96 +176,101 @@ def get_hg_ui_settings():
 
        if k == '/':
 
            k = 'root_path'
 

	
 
        if k.find('.') != -1:
 
            k = k.replace('.', '_')
 

	
 
        if each.ui_section == 'hooks':
 
            v = each.ui_active
 

	
 
        settings[each.ui_section + '_' + k] = v
 

	
 
    return settings
 

	
 
#propagated from mercurial documentation
 
ui_sections = ['alias', 'auth',
 
                'decode/encode', 'defaults',
 
                'diff', 'email',
 
                'extensions', 'format',
 
                'merge-patterns', 'merge-tools',
 
                'hooks', 'http_proxy',
 
                'smtp', 'patch',
 
                'paths', 'profiling',
 
                'server', 'trusted',
 
                'ui', 'web', ]
 

	
 
def make_ui(read_from='file', path=None, checkpaths=True):
 
    """
 
    A function that will read python rc files or database
 
    and make an mercurial ui object from read options
 
    
 
    :param path: path to mercurial config file
 
    :param checkpaths: check the path
 
    :param read_from: read from 'file' or 'db'
 
    """
 

	
 
    baseui = ui.ui()
 

	
 
    if read_from == 'file':
 
        if not os.path.isfile(path):
 
            log.warning('Unable to read config file %s' % path)
 
            return False
 
        log.debug('reading hgrc from %s', path)
 
        cfg = config.config()
 
        cfg.read(path)
 
        for section in ui_sections:
 
            for k, v in cfg.items(section):
 
                baseui.setconfig(section, k, v)
 
                log.debug('settings ui from file[%s]%s:%s', section, k, v)
 

	
 
        for k, v in baseui.configitems('extensions'):
 
            baseui.setconfig('extensions', k, '0')
 
        #just enable mq
 
        baseui.setconfig('extensions', 'mq', '1')
 
        if checkpaths:check_repo_dir(cfg.items('paths'))
 

	
 

	
 
    elif read_from == 'db':
 
        hg_ui = get_hg_ui_cached()
 
        for ui_ in hg_ui:
 
            if ui_.ui_active:
 
                log.debug('settings ui from db[%s]%s:%s', ui_.ui_section, ui_.ui_key, ui_.ui_value)
 
                baseui.setconfig(ui_.ui_section, ui_.ui_key, ui_.ui_value)
 

	
 

	
 
    return baseui
 

	
 

	
 
def set_rhodecode_config(config):
 
    hgsettings = get_hg_settings()
 

	
 
    for k, v in hgsettings.items():
 
        config[k] = v
 

	
 
def invalidate_cache(name, *args):
 
    """Invalidates given name cache"""
 

	
 
    from beaker.cache import region_invalidate
 
    log.info('INVALIDATING CACHE FOR %s', name)
 

	
 
    """propagate our arguments to make sure invalidation works. First
 
    argument has to be the name of cached func name give to cache decorator
 
    without that the invalidation would not work"""
 
    tmp = [name]
 
    tmp.extend(args)
 
    args = tuple(tmp)
 

	
 
    if name == 'cached_repo_list':
 
        from rhodecode.model.hg_model import _get_repos_cached
 
        region_invalidate(_get_repos_cached, None, *args)
 

	
 
    if name == 'full_changelog':
 
        from rhodecode.model.hg_model import _full_changelog_cached
 
        region_invalidate(_full_changelog_cached, None, *args)
 

	
 
class EmptyChangeset(BaseChangeset):
 
    """
 
    An dummy empty changeset.
 
    """
 

	
 
    revision = -1
 
    message = ''
rhodecode/model/db.py
Show inline comments
 
from rhodecode.model.meta import Base
 
from sqlalchemy import *
 
from sqlalchemy.orm import relation, backref
 
from sqlalchemy.orm.session import Session
 
from vcs.utils.lazy import LazyProperty
 
import logging
 

	
 
log = logging.getLogger(__name__)
 

	
 
class RhodeCodeSettings(Base):
 
    __tablename__ = 'rhodecode_settings'
 
    __table_args__ = (UniqueConstraint('app_settings_name'), {'useexisting':True})
 
    app_settings_id = Column("app_settings_id", INTEGER(), nullable=False, unique=True, default=None, primary_key=True)
 
    app_settings_name = Column("app_settings_name", TEXT(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
 
    app_settings_value = Column("app_settings_value", TEXT(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
 

	
 
class RhodeCodeUi(Base):
 
    __tablename__ = 'rhodecode_ui'
 
    __table_args__ = {'useexisting':True}
 
    ui_id = Column("ui_id", INTEGER(), nullable=False, unique=True, default=None, primary_key=True)
 
    ui_section = Column("ui_section", TEXT(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
 
    ui_key = Column("ui_key", TEXT(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
 
    ui_value = Column("ui_value", TEXT(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
 
    ui_active = Column("ui_active", BOOLEAN(), nullable=True, unique=None, default=True)
 
    
 
    
 
class User(Base): 
 

	
 

	
 
class User(Base):
 
    __tablename__ = 'users'
 
    __table_args__ = (UniqueConstraint('username'), UniqueConstraint('email'), {'useexisting':True})
 
    user_id = Column("user_id", INTEGER(), nullable=False, unique=True, default=None, primary_key=True)
 
    username = Column("username", TEXT(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
 
    password = Column("password", TEXT(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
 
    active = Column("active", BOOLEAN(), nullable=True, unique=None, default=None)
 
    admin = Column("admin", BOOLEAN(), nullable=True, unique=None, default=False)
 
    name = Column("name", TEXT(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
 
    lastname = Column("lastname", TEXT(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
 
    email = Column("email", TEXT(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
 
    last_login = Column("last_login", DATETIME(timezone=False), nullable=True, unique=None, default=None)
 
    
 

	
 
    user_log = relation('UserLog')
 
    user_perms = relation('UserToPerm', primaryjoin="User.user_id==UserToPerm.user_id")
 
    
 

	
 
    @LazyProperty
 
    def full_contact(self):
 
        return '%s %s <%s>' % (self.name, self.lastname, self.email)
 
        
 

	
 
    def __repr__(self):
 
        return "<User('id:%s:%s')>" % (self.user_id, self.username)
 
    
 

	
 
    def update_lastlogin(self):
 
        """Update user lastlogin"""
 
        import datetime
 
        
 

	
 
        try:
 
            session = Session.object_session(self)
 
            self.last_login = datetime.datetime.now()
 
            session.add(self)
 
            session.commit()
 
            log.debug('updated user %s lastlogin', self.username)
 
        except Exception:
 
            session.rollback()        
 
    
 
      
 
class UserLog(Base): 
 
            session.rollback()
 

	
 

	
 
class UserLog(Base):
 
    __tablename__ = 'user_logs'
 
    __table_args__ = {'useexisting':True}
 
    user_log_id = Column("user_log_id", INTEGER(), nullable=False, unique=True, default=None, primary_key=True)
 
    user_id = Column("user_id", INTEGER(), ForeignKey(u'users.user_id'), nullable=False, unique=None, default=None)
 
    repository_id = Column("repository_id", INTEGER(length=None, convert_unicode=False, assert_unicode=None), ForeignKey(u'repositories.repo_id'), nullable=False, unique=None, default=None)
 
    repository_name = Column("repository_name", TEXT(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
 
    user_ip = Column("user_ip", TEXT(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None) 
 
    user_ip = Column("user_ip", TEXT(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
 
    action = Column("action", TEXT(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
 
    action_date = Column("action_date", DATETIME(timezone=False), nullable=True, unique=None, default=None)
 
    revision = Column('revision', TEXT(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
 
    
 

	
 
    user = relation('User')
 
    repository = relation('Repository')
 
    
 

	
 
class Repository(Base):
 
    __tablename__ = 'repositories'
 
    __table_args__ = (UniqueConstraint('repo_name'), {'useexisting':True},)
 
    repo_id = Column("repo_id", INTEGER(), nullable=False, unique=True, default=None, primary_key=True)
 
    repo_name = Column("repo_name", TEXT(length=None, convert_unicode=False, assert_unicode=None), nullable=False, unique=True, default=None)
 
    user_id = Column("user_id", INTEGER(), ForeignKey(u'users.user_id'), nullable=False, unique=False, default=None)
 
    private = Column("private", BOOLEAN(), nullable=True, unique=None, default=None)
 
    description = Column("description", TEXT(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
 
    fork_id = Column("fork_id", INTEGER(), ForeignKey(u'repositories.repo_id'), nullable=True, unique=False, default=None)
 
    
 

	
 
    user = relation('User')
 
    fork = relation('Repository', remote_side=repo_id)
 
    repo_to_perm = relation('RepoToPerm', cascade='all')
 
    
 
    stats = relation('Statistics', cascade='all')
 

	
 

	
 
    def __repr__(self):
 
        return "<Repository('id:%s:%s')>" % (self.repo_id, self.repo_name)
 
        
 

	
 
class Permission(Base):
 
    __tablename__ = 'permissions'
 
    __table_args__ = {'useexisting':True}
 
    permission_id = Column("permission_id", INTEGER(), nullable=False, unique=True, default=None, primary_key=True)
 
    permission_name = Column("permission_name", TEXT(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
 
    permission_longname = Column("permission_longname", TEXT(length=None, convert_unicode=False, assert_unicode=None), nullable=True, unique=None, default=None)
 
    
 

	
 
    def __repr__(self):
 
        return "<Permission('%s:%s')>" % (self.permission_id, self.permission_name)
 

	
 
class RepoToPerm(Base):
 
    __tablename__ = 'repo_to_perm'
 
    __table_args__ = (UniqueConstraint('user_id', 'repository_id'), {'useexisting':True})
 
    repo_to_perm_id = Column("repo_to_perm_id", INTEGER(), nullable=False, unique=True, default=None, primary_key=True)
 
    user_id = Column("user_id", INTEGER(), ForeignKey(u'users.user_id'), nullable=False, unique=None, default=None)
 
    permission_id = Column("permission_id", INTEGER(), ForeignKey(u'permissions.permission_id'), nullable=False, unique=None, default=None)
 
    repository_id = Column("repository_id", INTEGER(), ForeignKey(u'repositories.repo_id'), nullable=False, unique=None, default=None) 
 
    
 
    repository_id = Column("repository_id", INTEGER(), ForeignKey(u'repositories.repo_id'), nullable=False, unique=None, default=None)
 

	
 
    user = relation('User')
 
    permission = relation('Permission')
 
    repository = relation('Repository')
 

	
 
class UserToPerm(Base):
 
    __tablename__ = 'user_to_perm'
 
    __table_args__ = (UniqueConstraint('user_id', 'permission_id'), {'useexisting':True})
 
    user_to_perm_id = Column("user_to_perm_id", INTEGER(), nullable=False, unique=True, default=None, primary_key=True)
 
    user_id = Column("user_id", INTEGER(), ForeignKey(u'users.user_id'), nullable=False, unique=None, default=None)
 
    permission_id = Column("permission_id", INTEGER(), ForeignKey(u'permissions.permission_id'), nullable=False, unique=None, default=None)
 
    
 

	
 
    user = relation('User')
 
    permission = relation('Permission')
 

	
 
class Statistics(Base):
 
    __tablename__ = 'statistics'
 
    __table_args__ = (UniqueConstraint('repository_id'), {'useexisting':True})
 
    stat_id = Column("stat_id", INTEGER(), nullable=False, unique=True, default=None, primary_key=True)
 
    repository_id = Column("repository_id", INTEGER(), ForeignKey(u'repositories.repo_id'), nullable=False, unique=True, default=None)
 
    stat_on_revision = Column("stat_on_revision", INTEGER(), nullable=False)
 
    commit_activity = Column("commit_activity", BLOB(), nullable=False)#JSON data
 
    commit_activity_combined = Column("commit_activity_combined", BLOB(), nullable=False)#JSON data
 
    languages = Column("languages", BLOB(), nullable=False)#JSON data
 
    
 
    repository = relation('Repository')
 

	
 
    repository = relation('Repository', single_parent=True)
 

	
rhodecode/public/css/style.css
Show inline comments
 
@@ -225,97 +225,97 @@ text-decoration:underline;
 
}
 
 
#header ul#logged-user li.highlight a {
 
color:#fff;
 
}
 
 
#header ul#logged-user li.highlight a:hover {
 
color:#376ea6;
 
}
 
 
#header #header-inner {
 
height:40px;
 
clear:both;
 
position:relative;
 
background:#003367 url("../images/header_inner.png") repeat-x;
 
border-bottom:2px solid #fff;
 
margin:0;
 
padding:0;
 
}
 
 
#header #header-inner #home a {
 
height:40px;
 
width:46px;
 
display:block;
 
background:url("../images/button_home.png");
 
background-position:0 0;
 
margin:0;
 
padding:0;
 
}
 
 
#header #header-inner #home a:hover {
 
background-position:0 -40px;
 
}
 
 
#header #header-inner #logo h1 {
 
color:#FFF;
 
font-size:14px;
 
text-transform:uppercase;
 
margin:13px 0 0 13px;
 
padding:0;
 
}
 
 
#header #header-inner #logo a {
 
color:#fff;
 
text-decoration:none;
 
}
 
 
#header #header-inner #logo a:hover {
 
color:#dabf29;
 
color:#bfe3ff;
 
}
 
 
#header #header-inner #quick,#header #header-inner #quick ul {
 
position:relative;
 
float:right;
 
list-style-type:none;
 
list-style-position:outside;
 
margin:10px 5px 0 0;
 
padding:0;
 
}
 
 
#header #header-inner #quick li {
 
position:relative;
 
float:left;
 
margin:0 5px 0 0;
 
padding:0;
 
}
 
 
#header #header-inner #quick li a {
 
top:0;
 
left:0;
 
height:1%;
 
display:block;
 
clear:both;
 
overflow:hidden;
 
color:#FFF;
 
font-weight:700;
 
text-decoration:none;
 
background:#369 url("../../images/quick_l.png") no-repeat top left;
 
padding:0;
 
}
 
 
#header #header-inner #quick li span {
 
top:0;
 
right:0;
 
height:1%;
 
display:block;
 
float:left;
 
background:url("../../images/quick_r.png") no-repeat top right;
 
border-left:1px solid #3f6f9f;
 
margin:0;
 
padding:10px 12px 8px 10px;
 
}
 
 
#header #header-inner #quick li span.normal {
 
border:none;
 
padding:10px 12px 8px;
 
}
 
@@ -374,97 +374,97 @@ height:auto;
 
display:block;
 
float:left;
 
background:#FFF;
 
color:#003367;
 
font-weight:400;
 
margin:0;
 
padding:7px 9px;
 
}
 
 
#header #header-inner #quick li ul li a:hover {
 
color:#000;
 
background:#FFF;
 
}
 
 
#header #header-inner #quick ul ul {
 
top:auto;
 
}
 
 
#header #header-inner #quick li ul ul {
 
right:200px;
 
max-height:275px;
 
overflow:auto;
 
overflow-x:hidden;
 
white-space:nowrap;
 
}
 
 
#header #header-inner #quick li ul li a.journal,#header #header-inner #quick li ul li a.journal:hover {
 
background:url("../images/icons/book.png") no-repeat scroll 4px 9px #FFF;
 
width:167px;
 
margin:0;
 
padding:12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.private_repo,#header #header-inner #quick li ul li a.private_repo:hover {
 
background:url("../images/icons/lock.png") no-repeat scroll 4px 9px #FFF;
 
min-width:167px;
 
margin:0;
 
padding:12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.public_repo,#header #header-inner #quick li ul li a.public_repo:hover {
 
background:url("../images/icons/lock_open.png") no-repeat scroll 4px 9px #FFF;
 
min-width:167px;
 
margin:0;
 
padding:12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.repos,#header #header-inner #quick li ul li a.repos:hover {
 
background:url("../images/icons/folder_edit.png") no-repeat scroll 4px 9px #FFF;
 
background:url("../images/icons/database_edit.png") no-repeat scroll 4px 9px #FFF;
 
width:167px;
 
margin:0;
 
padding:12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.users,#header #header-inner #quick li ul li a.users:hover {
 
background:#FFF url("../images/icons/user_edit.png") no-repeat 4px 9px;
 
width:167px;
 
margin:0;
 
padding:12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.settings,#header #header-inner #quick li ul li a.settings:hover {
 
background:#FFF url("../images/icons/cog.png") no-repeat 4px 9px;
 
width:167px;
 
margin:0;
 
padding:12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.permissions,#header #header-inner #quick li ul li a.permissions:hover {
 
background:#FFF url("../images/icons/key.png") no-repeat 4px 9px;
 
width:167px;
 
margin:0;
 
padding:12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.fork,#header #header-inner #quick li ul li a.fork:hover {
 
background:#FFF url("../images/icons/arrow_divide.png") no-repeat 4px 9px;
 
width:167px;
 
margin:0;
 
padding:12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.search,#header #header-inner #quick li ul li a.search:hover {
 
background:#FFF url("../images/icons/search_16.png") no-repeat 4px 9px;
 
width:167px;
 
margin:0;
 
padding:12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.delete,#header #header-inner #quick li ul li a.delete:hover {
 
background:#FFF url("../images/icons/delete.png") no-repeat 4px 9px;
 
width:167px;
 
margin:0;
 
padding:12px 9px 7px 24px;
 
}
 
 
#header #header-inner #quick li ul li a.branches,#header #header-inner #quick li ul li a.branches:hover {
 
@@ -965,97 +965,97 @@ border-bottom:1px solid #1a6480;
 
color:#FFF;
 
margin:0;
 
padding:6px 12px;
 
}
 
 
div.form div.fields div.field div.highlight .ui-state-hover {
 
background:#46a0c1 url("../images/button_highlight_selected.png") repeat-x;
 
border-top:1px solid #78acbf;
 
border-left:1px solid #34819e;
 
border-right:1px solid #35829f;
 
border-bottom:1px solid #257897;
 
color:#FFF;
 
margin:0;
 
padding:6px 12px;
 
}
 
 
#content div.box div.form div.fields div.buttons div.highlight input.ui-state-default {
 
background:#4e85bb url("../../images/button_highlight.png") repeat-x;
 
border-top:1px solid #5c91a4;
 
border-left:1px solid #2a6f89;
 
border-right:1px solid #2b7089;
 
border-bottom:1px solid #1a6480;
 
color:#fff;
 
margin:0;
 
padding:6px 12px;
 
}
 
 
#content div.box div.form div.fields div.buttons div.highlight input.ui-state-hover {
 
background:#46a0c1 url("../../images/button_highlight_selected.png") repeat-x;
 
border-top:1px solid #78acbf;
 
border-left:1px solid #34819e;
 
border-right:1px solid #35829f;
 
border-bottom:1px solid #257897;
 
color:#fff;
 
margin:0;
 
padding:6px 12px;
 
}
 
 
#content div.box table {
 
width:100%;
 
border-collapse:collapse;
 
margin:0;
 
padding:0;
 
}
 
 
#content div.box table th {
 
background:#eee;
 
border-bottom:1px solid #ddd;
 
padding:10px;
 
padding:5px 0px 5px 5px;
 
}
 
 
#content div.box table th.left {
 
text-align:left;
 
}
 
 
#content div.box table th.right {
 
text-align:right;
 
}
 
 
#content div.box table th.center {
 
text-align:center;
 
}
 
 
#content div.box table th.selected {
 
vertical-align:middle;
 
padding:0;
 
}
 
 
#content div.box table td {
 
background:#fff;
 
border-bottom:1px solid #cdcdcd;
 
vertical-align:middle;
 
padding:5px;
 
}
 
 
#content div.box table tr.selected td {
 
background:#FFC;
 
}
 
 
#content div.box table td.selected {
 
width:3%;
 
text-align:center;
 
vertical-align:middle;
 
padding:0;
 
}
 
 
#content div.box table td.action {
 
width:45%;
 
text-align:left;
 
}
 
 
#content div.box table td.date {
 
width:33%;
 
text-align:center;
 
}
 
 
#content div.box div.action {
 
@@ -1348,97 +1348,96 @@ padding:5px 0 0 5px;
 
 
#register div.form div.fields div.field div.input input {
 
width:245px;
 
background:#FFF;
 
border-top:1px solid #b3b3b3;
 
border-left:1px solid #b3b3b3;
 
border-right:1px solid #eaeaea;
 
border-bottom:1px solid #eaeaea;
 
color:#000;
 
font-family:Lucida Grande, Verdana, Lucida Sans Regular, Lucida Sans Unicode, Arial, sans-serif;
 
font-size:11px;
 
margin:0;
 
padding:7px 7px 6px;
 
}
 
 
#register div.form div.fields div.buttons {
 
clear:both;
 
overflow:hidden;
 
border-top:1px solid #DDD;
 
text-align:left;
 
margin:0;
 
padding:10px 0 0 114px;
 
}
 
 
#register div.form div.fields div.buttons div.highlight input.ui-state-default {
 
background:url("../images/button_highlight.png") repeat-x scroll 0 0 #4E85BB;
 
color:#FFF;
 
border-color:#5C91A4 #2B7089 #1A6480 #2A6F89;
 
border-style:solid;
 
border-width:1px;
 
}
 
 
#register div.form div.activation_msg {
 
padding-top:4px;
 
padding-bottom:4px;
 
}
 
 
.trending_language_tbl,.trending_language_tbl td {
 
border:0 !important;
 
margin:0 !important;
 
padding:0 !important;
 
}
 
 
.trending_language {
 
background-color:#003367;
 
color:#FFF;
 
display:block;
 
min-width:20px;
 
max-width:400px;
 
text-decoration:none;
 
height:12px;
 
margin-bottom:4px;
 
margin-left:5px;
 
white-space:pre;
 
padding:3px;
 
}
 
 
h3.files_location {
 
font-size:1.8em;
 
font-weight:700;
 
border-bottom:none !important;
 
margin:10px 0 !important;
 
}
 
 
#files_data dl dt {
 
float:left;
 
width:115px;
 
margin:0 !important;
 
padding:5px;
 
}
 
 
#files_data dl dd {
 
margin:0 !important;
 
padding:5px !important;
 
}
 
 
#changeset_content {
 
border:1px solid #CCC;
 
padding:5px;
 
}
 
 
#changeset_content .container {
 
min-height:120px;
 
font-size:1.2em;
 
overflow:hidden;
 
}
 
 
#changeset_content .container .right {
 
float:right;
 
width:25%;
 
text-align:right;
 
}
 
 
#changeset_content .container .left .message {
 
font-style:italic;
 
color:#556CB5;
 
white-space:pre-wrap;
 
@@ -1497,115 +1496,117 @@ min-height:80px;
 
overflow:hidden;
 
font-size:1.2em;
 
}
 
 
#graph_content .container .right {
 
float:right;
 
width:28%;
 
text-align:right;
 
padding-bottom:5px;
 
}
 
 
#graph_content .container .left .date {
 
font-weight:700;
 
padding-bottom:5px;
 
}
 
 
#graph_content .container .left .message {
 
font-size:100%;
 
padding-top:3px;
 
white-space:pre-wrap;
 
}
 
 
.right div {
 
clear:both;
 
}
 
 
.right .changes .added,.changed,.removed {
 
border:1px solid #DDD;
 
display:block;
 
float:right;
 
text-align:center;
 
min-width:15px;
 
}
 
 
.right .changes .added {
 
background:#BFB;
 
}
 
 
.right .changes .changed {
 
background:#FD8;
 
}
 
 
.right .changes .removed {
 
background:#F88;
 
}
 
 
.right .merge {
 
vertical-align:top;
 
font-size:60%;
 
font-size:0.75em;
 
font-weight:700;
 
}
 
 
.right .parent {
 
font-size:90%;
 
font-family:monospace;
 
}
 
 
.right .logtags .branchtag {
 
background:#FFF url("../images/icons/arrow_branch.png") no-repeat right 6px;
 
display:block;
 
padding:8px 16px 0 0;
 
font-size:0.8em;
 
padding:11px 16px 0 0;
 
}
 
 
.right .logtags .tagtag {
 
background:#FFF url("../images/icons/tag_blue.png") no-repeat right 6px;
 
display:block;
 
padding:6px 18px 0 0;
 
font-size:0.8em;
 
padding:11px 16px 0 0;
 
}
 
 
div.browserblock {
 
overflow:hidden;
 
border:1px solid #ccc;
 
background:#f8f8f8;
 
font-size:100%;
 
line-height:125%;
 
padding:0;
 
}
 
 
div.browserblock .browser-header {
 
border-bottom:1px solid #CCC;
 
background:#FFF;
 
color:blue;
 
padding:10px 0;
 
}
 
 
div.browserblock .browser-header span {
 
margin-left:25px;
 
font-weight:700;
 
}
 
 
div.browserblock .browser-body {
 
background:#EEE;
 
}
 
 
table.code-browser {
 
border-collapse:collapse;
 
width:100%;
 
}
 
 
table.code-browser tr {
 
margin:3px;
 
}
 
 
table.code-browser thead th {
 
background-color:#EEE;
 
height:20px;
 
font-size:1.1em;
 
font-weight:700;
 
text-align:left;
 
padding-left:10px;
 
}
 
 
table.code-browser tbody td {
 
padding-left:10px;
 
height:20px;
 
@@ -1656,96 +1657,97 @@ color:red;
 
font-size:1.2em;
 
padding-left:4px;
 
}
 
 
.info_box * {
 
background:url("../../images/pager.png") repeat-x scroll 0 0 #EBEBEB;
 
color:#4A4A4A;
 
font-weight:700;
 
height:1%;
 
display:inline;
 
border-color:#DEDEDE #C4C4C4 #C4C4C4 #CFCFCF;
 
border-style:solid;
 
border-width:1px;
 
padding:4px 6px;
 
}
 
 
.info_box span {
 
margin-left:3px;
 
margin-right:3px;
 
}
 
 
.info_box input#at_rev {
 
text-align:center;
 
padding:5px 3px 3px 2px;
 
}
 
 
.info_box input#view {
 
text-align:center;
 
padding:4px 3px 2px 2px;
 
}
 
 
.yui-overlay,.yui-panel-container {
 
visibility:hidden;
 
position:absolute;
 
z-index:2;
 
}
 
 
.yui-tt {
 
visibility:hidden;
 
position:absolute;
 
color:#666;
 
background-color:#FFF;
 
font-family:arial, helvetica, verdana, sans-serif;
 
border:2px solid #003367;
 
font:100% sans-serif;
 
width:auto;
 
opacity:1px;
 
padding:8px;
 
white-space: pre;
 
}
 
 
.ac {
 
vertical-align:top;
 
}
 
 
.ac .yui-ac {
 
position:relative;
 
font-family:arial;
 
font-size:100%;
 
}
 
 
.ac .perm_ac {
 
width:15em;
 
}
 
 
.ac .yui-ac-input {
 
width:100%;
 
}
 
 
.ac .yui-ac-container {
 
position:absolute;
 
top:1.6em;
 
width:100%;
 
}
 
 
.ac .yui-ac-content {
 
position:absolute;
 
width:100%;
 
border:1px solid gray;
 
background:#fff;
 
overflow:hidden;
 
z-index:9050;
 
}
 
 
.ac .yui-ac-shadow {
 
position:absolute;
 
width:100%;
 
background:#000;
 
-moz-opacity:0.1px;
 
opacity:.10;
 
filter:alpha(opacity =   10);
 
z-index:9049;
 
margin:.3em;
 
}
 
 
.ac .yui-ac-content ul {
 
width:100%;
 
@@ -1979,97 +1981,96 @@ color:#FFF;
 
background:#4e85bb url("../../images/button_highlight.png") repeat-x;
 
border-top:1px solid #5c91a4;
 
border-left:1px solid #2a6f89;
 
border-right:1px solid #2b7089;
 
border-bottom:1px solid #1a6480;
 
color:#fff;
 
}
 
 
#content div.box div.form div.fields div.field div.highlight .ui-state-hover {
 
background:#46a0c1 url("../../images/button_highlight_selected.png") repeat-x;
 
border-top:1px solid #78acbf;
 
border-left:1px solid #34819e;
 
border-right:1px solid #35829f;
 
border-bottom:1px solid #257897;
 
color:#fff;
 
}
 
 
ins,div.options a:hover {
 
text-decoration:none;
 
}
 
 
img,#header #header-inner #quick li a:hover span.normal,#header #header-inner #quick li ul li.last,#content div.box div.form div.fields div.field div.textarea table td table td a,#clone_url {
 
border:none;
 
}
 
 
img.icon,.right .merge img {
 
vertical-align:bottom;
 
}
 
 
#header ul#logged-user,#content div.box div.title ul.links,#content div.box div.message div.dismiss,#content div.box div.traffic div.legend ul {
 
float:right;
 
margin:0;
 
padding:0;
 
}
 
 
#header #header-inner #home,#header #header-inner #logo,#content div.box ul.left,#content div.box ol.left,#content div.box div.pagination-left,div#commit_history,div#legend_data,div#legend_container,div#legend_choices {
 
float:left;
 
}
 
 
#header #header-inner #quick li:hover ul ul,#header #header-inner #quick li:hover ul ul ul,#header #header-inner #quick li:hover ul ul ul ul,#content #left #menu ul.closed,#content #left #menu li ul.collapsed,.yui-tt-shadow {
 
display:none;
 
}
 
 
#header #header-inner #quick li:hover ul,#header #header-inner #quick li li:hover ul,#header #header-inner #quick li li li:hover ul,#header #header-inner #quick li li li li:hover ul,#content #left #menu ul.opened,#content #left #menu li ul.expanded {
 
display:block;
 
}
 
 
#content div.box div.title ul.links li a:hover,#content div.box div.title ul.links li.ui-tabs-selected a {
 
background:url("../../images/title_tab_selected.png") no-repeat bottom center;
 
color:#bfe3ff;
 
}
 
 
#content div.box ol.lower-roman,#content div.box ol.upper-roman,#content div.box ol.lower-alpha,#content div.box ol.upper-alpha,#content div.box ol.decimal {
 
margin:10px 24px 10px 44px;
 
}
 
 
#content div.box div.form,#content div.box div.table,#content div.box div.traffic {
 
clear:both;
 
overflow:hidden;
 
margin:0;
 
padding:0 20px 10px;
 
}
 
 
#content div.box div.form div.fields,#login div.form,#login div.form div.fields,#register div.form,#register div.form div.fields {
 
clear:both;
 
overflow:hidden;
 
margin:0;
 
padding:0;
 
}
 
 
#content div.box div.form div.fields div.field div.label-checkbox,#content div.box div.form div.fields div.field div.label-radio,#content div.box div.form div.fields div.field div.label-textarea {
 
padding:0 0 0 5px !important;
 
}
 
 
#content div.box div.form div.fields div.field div.label span,#login div.form div.fields div.field div.label span,#register div.form div.fields div.field div.label span {
 
height:1%;
 
display:block;
 
color:#363636;
 
margin:0;
 
padding:2px 0 0;
 
}
 
 
#content div.box div.form div.fields div.field div.input input.error,#login div.form div.fields div.field div.input input.error,#register div.form div.fields div.field div.input input.error {
 
background:#FBE3E4;
 
border-top:1px solid #e1b2b3;
 
border-left:1px solid #e1b2b3;
 
border-right:1px solid #FBC2C4;
 
border-bottom:1px solid #FBC2C4;
 
}
 
 
#content div.box div.form div.fields div.field div.input input.success,#login div.form div.fields div.field div.input input.success,#register div.form div.fields div.field div.input input.success {
 
background:#E6EFC2;
 
border-top:1px solid #cebb98;
 
border-left:1px solid #cebb98;
 
border-right:1px solid #c6d880;
 
border-bottom:1px solid #c6d880;
 
}
rhodecode/templates/files/files_browser.html
Show inline comments
 
<%def name="file_class(node)">
 
	%if node.is_file():
 
		<%return "browser-file" %>
 
	%else:
 
		<%return "browser-dir"%>
 
	%endif
 
</%def>
 
<div id="body" class="browserblock">
 
	<div class="browser-header">
 
		${h.form(h.url.current())}
 
		<div class="info_box">
 
          <span >${_('view')}@rev</span> 
 
          <a href="${c.url_prev}">&laquo;</a>
 
          ${h.text('at_rev',value=c.rev_nr,size=3)}
 
          <a href="${c.url_next}">&raquo;</a>
 
          ${h.submit('view','view')}
 
	    </div>           
 
		${h.end_form()}
 
	</div>
 
	<div class="browser-body">
 
		<table class="code-browser">
 
		         <thead>
 
		             <tr>
 
		                 <th>${_('Name')}</th>
 
		                 <th>${_('Size')}</th>
 
		                 <th>${_('Mimetype')}</th>
 
		                 <th>${_('Revision')}</th>
 
		                 <th>${_('Last modified')}</th>
 
		                 <th>${_('Last commiter')}</th>
 
		             </tr>
 
		         </thead>
 

	
 
          		% if c.files_list.parent:
 
         		<tr class="parity0">
 
	          		<td>		          		
 
	          			${h.link_to('..',h.url('files_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=c.files_list.parent.path),class_="browser-dir")}
 
	          		</td>
 
	          		<td></td>
 
	          		<td></td>
 
	          		<td></td>
 
	          		<td></td>
 
	          		<td></td>
 
				</tr>	          		
 
          		%endif
 
		         	
 
		    %for cnt,node in enumerate(c.files_list,1):
 
				<tr class="parity${cnt%2}">
 
		    %for cnt,node in enumerate(c.files_list):
 
				<tr class="parity${(cnt+1)%2}">
 
		             <td>
 
						${h.link_to(node.name,h.url('files_home',repo_name=c.repo_name,revision=c.cur_rev,f_path=node.path),class_=file_class(node))}
 
		             </td>
 
		             <td>
 
		             %if node.is_file():
 
		             	${h.format_byte_size(node.size,binary=True)}
 
		             %endif	
 
		             </td>
 
		             <td>
 
		              %if node.is_file():
 
		                  ${node.mimetype}
 
		              %endif
 
		             </td>
 
		             <td>
 
		             	%if node.is_file():
 
		             		${node.last_changeset.revision}
 
		             	%endif
 
	             	  %if node.is_file():
 
	             		  ${node.last_changeset.revision}
 
	             	  %endif
 
		             </td>
 
		             <td>
 
		             	%if node.is_file():
 
		             		${h.age(node.last_changeset._ctx.date())} - ${node.last_changeset.date}
 
		             	%endif
 
		              %if node.is_file():
 
		                  ${h.age(node.last_changeset._ctx.date())} - ${node.last_changeset.date}
 
		              %endif
 
		             </td>
 
		             <td>
 
		             	%if node.is_file():
 
		             		${node.last_changeset.author}
 
		             	%endif                    
 
		              %if node.is_file():
 
		                  ${node.last_changeset.author}
 
		              %endif                    
 
		             </td>
 
				</tr>
 
			%endfor
 
		</table>
 
	</div>
 
</div>
 
\ No newline at end of file
rhodecode/templates/summary/summary.html
Show inline comments
 
@@ -86,101 +86,103 @@ E.onDOMReady(function(e){
 
			  		${_('Email')}: <a href="mailto:${c.repo_info.dbrepo.user.email}">${c.repo_info.dbrepo.user.email}</a>
 
			  </div>
 
			 </div>
 
			
 
			 <div class="field">
 
			  <div class="label">
 
			      <label>${_('Last change')}:</label>
 
			  </div>
 
			  <div class="input-short">
 
			      ${h.age(c.repo_info.last_change)} - ${h.rfc822date_notz(c.repo_info.last_change)} 
 
			      ${_('by')} ${h.get_changeset_safe(c.repo_info,'tip').author} 
 
			      
 
			  </div>
 
			 </div>
 
			
 
			 <div class="field">
 
			  <div class="label">
 
			      <label>${_('Clone url')}:</label>
 
			  </div>
 
			  <div class="input-short">
 
			      <input type="text" id="clone_url" readonly="readonly" value="hg clone ${c.clone_repo_url}" size="70"/>
 
			  </div>
 
			 </div>
 
			 
 
			 <div class="field">
 
			  <div class="label">
 
			      <label>${_('Trending languages')}:</label>
 
			  </div>
 
			  <div class="input-short">
 
			    <div id="lang_stats">
 
			    
 
			    </div> 			  
 
			  	<script type="text/javascript">
 
			  		var data = ${c.trending_languages|n};
 
			  		var total = 0;
 
			  		var no_data = true;
 
			  		for (k in data){
 
			  		    total += data[k];
 
			  		    no_data = false;
 
			  		} 
 
					var tbl = document.createElement('table');
 
					tbl.setAttribute('class','trending_language_tbl');
 
			  		for (k in data){
 
				  		var tr = document.createElement('tr');
 
				  		var percentage = Math.round((data[k]/total*100),2);
 
						var value = data[k];
 
				  		var td1 = document.createElement('td');
 
				  		td1.width=150;
 
                        
 
				  		var trending_language_label = document.createElement('div');
 
				  		trending_language_label.innerHTML = k;
 
				  		td1.appendChild(trending_language_label);
 

	
 
				  		var td2 = document.createElement('td');
 
				  		td2.setAttribute('style','padding-right: 12px ! important;');
 
			  		    var trending_language = document.createElement('div');
 
			  		    trending_language.title = k;
 
			  		    trending_language.innerHTML = "<b>"+percentage+"% "+value+" ${_('files')}</b>";
 
			  		    trending_language.setAttribute("class", 'trending_language top-right-rounded-corner bottom-right-rounded-corner');
 
			  		    trending_language.style.width=percentage+"%";
 
						td2.appendChild(trending_language);
 
						
 
						tr.appendChild(td1);
 
						tr.appendChild(td2);
 
			  		    tbl.appendChild(tr);
 
			  		    
 
			  		}
 
			  		if(no_data){
 
			  			var tr = document.createElement('tr');
 
			  			var td1 = document.createElement('td');
 
			  			td1.innerHTML = "${_('No data loaded yet')}";
 
			  			tr.appendChild(td1);
 
			  			tbl.appendChild(tr);
 
					}
 
			  		YAHOO.util.Dom.get('lang_stats').appendChild(tbl);
 
			  	</script>
 
 
 
			  </div>
 
			 </div>
 
			 			
 
			 <div class="field">
 
			  <div class="label">
 
			      <label>${_('Download')}:</label>
 
			  </div>
 
			  <div class="input-short">
 
		        %for cnt,archive in enumerate(c.repo_info._get_archives()):
 
		             %if cnt >=1:
 
		             |
 
		             %endif
 
		             ${h.link_to(c.repo_info.name+'.'+archive['type'],
 
		                h.url('files_archive_home',repo_name=c.repo_info.name,
 
		                revision='tip',fileformat=archive['extension']),class_="archive_icon")}
 
		        %endfor
 
			  </div>
 
			 </div>
 
			 
 
			 <div class="field">
 
			  <div class="label">
 
			      <label>${_('Feeds')}:</label>
 
			  </div>
 
			  <div class="input-short">
 
	            ${h.link_to(_('RSS'),h.url('rss_feed_home',repo_name=c.repo_info.name),class_='rss_icon')}
 
	            ${h.link_to(_('Atom'),h.url('atom_feed_home',repo_name=c.repo_info.name),class_='atom_icon')}
0 comments (0 inline, 0 general)