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 @@ -30,7 +30,8 @@ def make_map(config): m.connect('admin_add_repo', '/add_repo/{new_repo:[a-z0-9\. _-]*}', action='add_repo') - map.connect('summary_home', '/{repo_name}/_summary', controller='hg', action='view') + map.connect('summary_home', '/{repo_name}/_summary', controller='hg', action='view') + map.connect('hg', '/{path_info:.*}', controller='hg', action="view", path_info='/') diff --git a/pylons_app/controllers/hg.py b/pylons_app/controllers/hg.py --- a/pylons_app/controllers/hg.py +++ b/pylons_app/controllers/hg.py @@ -38,9 +38,12 @@ class HgController(BaseController): def view(self, *args, **kwargs): #TODO: reimplement this not tu use hgwebdir + #patch for replacing mercurial servings with hg_app servings vcs_impl = self._get_vcs_impl(request.environ) if vcs_impl: return vcs_impl + + response = g.hgapp(request.environ, self.start_response) http_accept = request.environ.get('HTTP_ACCEPT', False) @@ -79,4 +82,7 @@ class HgController(BaseController): hg_model = HgModel() c.repo_info = hg_model.get_repo(c.repo_name) c.repo_changesets = c.repo_info.get_changesets(10) +# c.repo_tags = c.repo_info.get_tags(limit=10) +# c.repo_branches = c.repo_info.get_branches(limit=10) return render('/summary.html') + diff --git a/pylons_app/lib/app_globals.py b/pylons_app/lib/app_globals.py --- a/pylons_app/lib/app_globals.py +++ b/pylons_app/lib/app_globals.py @@ -22,9 +22,6 @@ class Globals(object): 'app_globals' variable """ - #two ways of building the merc app i don't know - #the fastest one but belive the wsgiapp is better - #self.hgapp = self.make_web_app() self.cache = CacheManager(**parse_cache_config_options(config)) self.hgapp = wsgiapplication(self.make_web_app) 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,11 +1,14 @@ from mercurial import util +from mercurial.templatefilters import age as _age +age = lambda context, x:_age(x) capitalize = lambda x: x.capitalize() date = lambda x: util.datestr(x) email = util.email -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]) +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 x: util.datestr(x, "%Y-%m-%dT%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") diff --git a/pylons_app/model/hg_model.py b/pylons_app/model/hg_model.py --- a/pylons_app/model/hg_model.py +++ b/pylons_app/model/hg_model.py @@ -15,7 +15,6 @@ try: from vcs.backends.hg import get_repositories, MercurialRepository except ImportError: print 'You have to import vcs module' -from mercurial.templatefilters import age class HgModel(object): """ @@ -43,7 +42,7 @@ class HgModel(object): tmp_d['name_sort'] = tmp_d['name'] tmp_d['description'] = mercurial_repo.description tmp_d['description_sort'] = tmp_d['description'] - tmp_d['last_change'] = age(last_change) + tmp_d['last_change'] = last_change tmp_d['last_change_sort'] = last_change[1] - last_change[0] tmp_d['tip'] = str(tip) tmp_d['tip_sort'] = tip.rev() @@ -55,6 +54,6 @@ class HgModel(object): yield tmp_d def get_repo(self, repo_name): - path = g.paths[0][1] - repo = MercurialRepository(os.path.join(path, repo_name), g.baseui) + path = g.paths[0][1].replace('*', '') + repo = MercurialRepository(os.path.join(path, repo_name), baseui=g.baseui) return repo 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 @@ -36,9 +36,9 @@ %for cnt,repo in enumerate(c.repos_list): - ${repo['name']} + ${h.link(repo['name'],h.url('summary_home',repo_name=repo['name']))} ${repo['description']} - ${repo['last_change']} + ${repo['last_change']|n,self.f.age} r${repo['rev']}:${repo['tip']} ${repo['contact']} 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 @@ -40,20 +40,20 @@
contact
${c.repo_info.contact}
last change
-
${c.repo_info.last_change|n,self.f.rfc822date}
+
${c.repo_info.last_change|n,self.f.time_ago}

Changes

%for cnt,cs in enumerate(c.repo_changesets): - + - + %endfor @@ -62,9 +62,11 @@
${cs.date}${cs._ctx.date()|n,self.f.time_ago} ${cs.author}${cs.message}${h.link_to(cs.message,h.url('rev/'+str(cs._ctx)))} - ${h.link_to(u'changset')} + ${h.link_to(_('changeset'),h.url('file/'+str(cs._ctx)))} | - ${h.link_to(u'files')} + ${h.link_to(_('files'),h.url('file/'+str(cs._ctx)))}
-

Tags

+

${_('Tags')}

-{tags} + %for tag in c.repo_tags: + ${tag} + %endfor @@ -72,7 +74,9 @@
...
- {branches%branchentry} + %for branch in c.repo_branches: + ${branch} + %endfor
...