diff --git a/development.ini b/development.ini
--- a/development.ini
+++ b/development.ini
@@ -19,6 +19,7 @@ debug = true
#error_message = 'mercurial crash !'
[server:main]
+threadpool_workers = 5
use = egg:Paste#http
host = 127.0.0.1
port = 5000
diff --git a/production.ini b/production.ini
--- a/production.ini
+++ b/production.ini
@@ -19,6 +19,7 @@ debug = true
#error_message = 'mercurial crash !'
[server:main]
+threadpool_workers = 10
use = egg:Paste#http
host = 127.0.0.1
port = 8001
diff --git a/pylons_app/config/routing.py b/pylons_app/config/routing.py
--- a/pylons_app/config/routing.py
+++ b/pylons_app/config/routing.py
@@ -31,6 +31,7 @@ def make_map(config):
map.connect('summary_home', '/{repo_name}/_summary', controller='summary')
+ map.connect('shortlog_home', '/{repo_name}/_shortlog', controller='shortlog')
map.connect('hg', '/{path_info:.*}', controller='hg',
action="view", path_info='/')
diff --git a/pylons_app/controllers/shortlog.py b/pylons_app/controllers/shortlog.py
new file mode 100644
--- /dev/null
+++ b/pylons_app/controllers/shortlog.py
@@ -0,0 +1,35 @@
+import logging
+
+from pylons import tmpl_context as c, app_globals as g, session, request, config, url
+from pylons.controllers.util import abort, redirect
+
+from pylons_app.lib.base import BaseController, render
+from pylons_app.lib.utils import get_repo_slug
+from pylons_app.model.hg_model import HgModel
+from webhelpers.paginate import Page
+log = logging.getLogger(__name__)
+
+class ShortlogController(BaseController):
+ def __before__(self):
+ c.repos_prefix = config['repos_name']
+ c.staticurl = g.statics
+ c.repo_name = get_repo_slug(request)
+
+
+ def index(self):
+ hg_model = HgModel()
+ lim = 20
+ p = int(request.params.get('page', 1))
+ repo = hg_model.get_repo(c.repo_name)
+ cnt = repo.revisions[-1]
+ gen = repo.get_changesets(None)
+ repo_changesets = list(gen)
+ repo_changesets2 = list(gen)
+ repo_changesets3 = list(gen)
+ repo_changesets4 = list(gen)
+
+ c.repo_changesets = Page(repo_changesets, page=p, item_count=cnt, items_per_page=lim)
+ c.shortlog_data = render('shortlog_data.html')
+ if request.params.get('partial'):
+ return c.shortlog_data
+ return render('/shortlog.html')
diff --git a/pylons_app/lib/filters.py b/pylons_app/lib/filters.py
--- a/pylons_app/lib/filters.py
+++ b/pylons_app/lib/filters.py
@@ -1,14 +1,15 @@
from mercurial import util
-from mercurial.templatefilters import age as _age
+from mercurial.templatefilters import age as _age, person as _person
-age = lambda context, x:_age(x)
+age = lambda x:_age(x)
capitalize = lambda x: x.capitalize()
date = lambda x: util.datestr(x)
email = util.email
-hgdate = lambda context, x: "%d %d" % x
-isodate = lambda context, x: util.datestr(x, '%Y-%m-%d %H:%M %1%2')
-isodatesec = lambda context, x: util.datestr(x, '%Y-%m-%d %H:%M:%S %1%2')
-localdate = lambda context, x: (x[0], util.makedate()[1])
-rfc822date = lambda context, x: util.datestr(x, "%a, %d %b %Y %H:%M:%S %1%2")
-rfc3339date = lambda context, x: util.datestr(x, "%Y-%m-%dT%H:%M:%S%1:%2")
-time_ago = lambda context, x: util.datestr(_age(x), "%a, %d %b %Y %H:%M:%S %1%2")
+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")
+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")
diff --git a/pylons_app/templates/admin_log.html b/pylons_app/templates/admin_log.html
--- a/pylons_app/templates/admin_log.html
+++ b/pylons_app/templates/admin_log.html
@@ -1,3 +1,4 @@
+## -*- coding: utf-8 -*-
%if c.users_log:
@@ -17,11 +18,19 @@
%endfor
+
${c.users_log.pager('$link_previous ~2~ $link_next',
onclick="""YAHOO.util.Connect.asyncRequest('GET','$partial_url',{
- success:function(o){YAHOO.util.Dom.get('user_log').innerHTML=o.responseText;}
- },null); return false;""")} |
-
+ success:function(o){YAHOO.util.Dom.get(data_div).innerHTML=o.responseText;
+ YAHOO.util.Event.addListener(YAHOO.util.Dom.getElementsByClassName('pager_link'),"click",function(){
+ YAHOO.util.Dom.setStyle(data_div,'opacity','0.3');});
+ YAHOO.util.Dom.setStyle(data_div,'opacity','1');}},null); return false;""")}
+
%else:
diff --git a/pylons_app/templates/base/base.html b/pylons_app/templates/base/base.html
--- a/pylons_app/templates/base/base.html
+++ b/pylons_app/templates/base/base.html
@@ -1,7 +1,4 @@
## -*- coding: utf-8 -*-
-##filters definition
-<%namespace name="f" module="pylons_app.lib.filters" inheritable="True"/>
-
diff --git a/pylons_app/templates/index.html b/pylons_app/templates/index.html
--- a/pylons_app/templates/index.html
+++ b/pylons_app/templates/index.html
@@ -1,5 +1,7 @@
## -*- coding: utf-8 -*-
-
+<%!
+from pylons_app.lib import filters
+%>
<%inherit file="base/base.html"/>
<%def name="title()">
${c.repos_prefix} Mercurial Repositories
@@ -38,7 +40,7 @@
${h.link(repo['name'],h.url('summary_home',repo_name=repo['name']))} |
${repo['description']} |
- ${repo['last_change']|n,self.f.age} |
+ ${repo['last_change']|n,filters.age} |
r${repo['rev']}:${repo['tip']} |
${repo['contact']} |
diff --git a/pylons_app/templates/shortlog.html b/pylons_app/templates/shortlog.html
new file mode 100644
--- /dev/null
+++ b/pylons_app/templates/shortlog.html
@@ -0,0 +1,38 @@
+<%inherit file="base/base.html"/>
+
+<%def name="title()">
+ ${_('Repository managment')}
+%def>
+<%def name="breadcrumbs()">
+ ${h.link_to(u'Home',h.url('/'))}
+ /
+ ${h.link_to(c.repo_name,h.url('shortlog_home',repo_name=c.repo_name))}
+ /
+ ${_('shortlog')}
+%def>
+<%def name="page_nav()">
+
+
+
+ - ${h.link(_('summary'),h.url('summary_home',repo_name=c.repo_name))}
+ - ${_('shortlog')}
+ - changelog
+ - graph
+ - tags
+ - branches
+ - files
+
+%def>
+<%def name="main()">
+
+ ${_('Shortlog')}
+
+
+ ${c.shortlog_data}
+
+%def>
\ No newline at end of file
diff --git a/pylons_app/templates/shortlog_data.html b/pylons_app/templates/shortlog_data.html
new file mode 100644
--- /dev/null
+++ b/pylons_app/templates/shortlog_data.html
@@ -0,0 +1,32 @@
+## -*- coding: utf-8 -*-
+<%!
+from pylons_app.lib import filters
+%>
+
+%for cnt,cs in enumerate(c.repo_changesets):
+
+ ${cs._ctx.date()|n,filters.age} |
+ ${cs.author|n,filters.person} |
+ ${h.link_to(cs.message,h.url('rev/'+str(cs._ctx)))} |
+
+ ${h.link_to(_('changeset'),h.url('file/'+str(cs._ctx)))}
+ |
+ ${h.link_to(_('files'),h.url('file/'+str(cs._ctx)))}
+ |
+
+%endfor
+
+
+ ${c.repo_changesets.pager('$link_previous ~2~ $link_next',
+ onclick="""YAHOO.util.Connect.asyncRequest('GET','$partial_url',{
+ success:function(o){YAHOO.util.Dom.get(data_div).innerHTML=o.responseText;
+ YAHOO.util.Event.addListener(YAHOO.util.Dom.getElementsByClassName('pager_link'),"click",function(){
+ YAHOO.util.Dom.setStyle(data_div,'opacity','0.3');});
+ YAHOO.util.Dom.setStyle(data_div,'opacity','1');}},null); return false;""")} |
+
+
\ No newline at end of file
diff --git a/pylons_app/templates/summary.html b/pylons_app/templates/summary.html
--- a/pylons_app/templates/summary.html
+++ b/pylons_app/templates/summary.html
@@ -1,5 +1,7 @@
<%inherit file="base/base.html"/>
-
+<%!
+from pylons_app.lib import filters
+%>
<%def name="title()">
${_('Repository managment')}
%def>
@@ -19,8 +21,8 @@
- - summary
- - shortlog
+ - ${_('summary')}
+ - ${h.link(_('shortlog'),h.url('shortlog_home',repo_name=c.repo_name))}
- changelog
- graph
- tags
@@ -39,7 +41,7 @@
- ${_('contact')}
- ${c.repo_info.contact}
- ${_('last change')}
- - ${c.repo_info.last_change|n,self.f.rfc822date} - ${c.repo_info.last_change|n,self.f.age}
+ - ${c.repo_info.last_change|n,filters.rfc822date} - ${c.repo_info.last_change|n,filters.age}
- ${_('url')}
$ hg clone ${c.clone_repo_url}
- ${_('Download')}
@@ -57,7 +59,7 @@
%for cnt,cs in enumerate(c.repo_changesets):
- ${cs._ctx.date()|n,self.f.age} |
+ ${cs._ctx.date()|n,filters.age} |
${cs.author} |
${h.link_to(cs.message,h.url('rev/'+str(cs._ctx)))} |
diff --git a/pylons_app/tests/functional/test_shortlog.py b/pylons_app/tests/functional/test_shortlog.py
new file mode 100644
--- /dev/null
+++ b/pylons_app/tests/functional/test_shortlog.py
@@ -0,0 +1,7 @@
+from pylons_app.tests import *
+
+class TestShortlogController(TestController):
+
+ def test_index(self):
+ response = self.app.get(url(controller='shortlog', action='index'))
+ # Test response...
| |