##// END OF EJS Templates
Started summary page. Added filters to templates. used by n,self.f.filtername prefixed by n to disable other filters. Few other fixes found
Started summary page. Added filters to templates. used by n,self.f.filtername prefixed by n to disable other filters. Few other fixes found

File last commit:

r74:cdf4fda6 default
r74:cdf4fda6 default
Show More
hg_model.py
60 lines | 1.8 KiB | text/x-python | PythonLexer
Marcin Kuzminski
Added hg model,implemented removal of repos, added HgModel for fetching repos(with generator)
r58 #!/usr/bin/env python
# encoding: utf-8
#
# Copyright (c) 2010 marcink. All rights reserved.
#
'''
Created on Apr 9, 2010
@author: marcink
'''
import os
from pylons import tmpl_context as c, app_globals as g, session, request, config
from pylons.controllers.util import abort
try:
Marcin Kuzminski
Started summary page. Added filters to templates. used by n,self.f.filtername prefixed by n to disable other filters. Few other fixes found
r74 from vcs.backends.hg import get_repositories, MercurialRepository
Marcin Kuzminski
Added hg model,implemented removal of repos, added HgModel for fetching repos(with generator)
r58 except ImportError:
print 'You have to import vcs module'
from mercurial.templatefilters import age
class HgModel(object):
"""
Mercurial Model
"""
def __init__(self):
"""
Constructor
"""
Marcin Kuzminski
Updated model with never vcs implementation using MercurialRepo class
r73 pass
Marcin Kuzminski
Added hg model,implemented removal of repos, added HgModel for fetching repos(with generator)
r58
def get_repos(self):
Marcin Kuzminski
Updated model with never vcs implementation using MercurialRepo class
r73 for mercurial_repo in get_repositories(g.paths[0][0], g.paths[0][1], g.baseui):
if mercurial_repo._get_hidden():
#skip hidden web repository
continue
last_change = mercurial_repo.last_change
tip = mercurial_repo.repo.changectx('tip')
Marcin Kuzminski
Added hg model,implemented removal of repos, added HgModel for fetching repos(with generator)
r58 tmp_d = {}
Marcin Kuzminski
Updated model with never vcs implementation using MercurialRepo class
r73 tmp_d['name'] = mercurial_repo.name
Marcin Kuzminski
Added hg model,implemented removal of repos, added HgModel for fetching repos(with generator)
r58 tmp_d['name_sort'] = tmp_d['name']
Marcin Kuzminski
Updated model with never vcs implementation using MercurialRepo class
r73 tmp_d['description'] = mercurial_repo.description
Marcin Kuzminski
Added hg model,implemented removal of repos, added HgModel for fetching repos(with generator)
r58 tmp_d['description_sort'] = tmp_d['description']
tmp_d['last_change'] = age(last_change)
tmp_d['last_change_sort'] = last_change[1] - last_change[0]
tmp_d['tip'] = str(tip)
tmp_d['tip_sort'] = tip.rev()
tmp_d['rev'] = tip.rev()
Marcin Kuzminski
Updated model with never vcs implementation using MercurialRepo class
r73 tmp_d['contact'] = mercurial_repo.contact
tmp_d['contact_sort'] = tmp_d['contact']
tmp_d['repo_archives'] = mercurial_repo._get_archive_list()
Marcin Kuzminski
Added hg model,implemented removal of repos, added HgModel for fetching repos(with generator)
r58
yield tmp_d
Marcin Kuzminski
Started summary page. Added filters to templates. used by n,self.f.filtername prefixed by n to disable other filters. Few other fixes found
r74
def get_repo(self, repo_name):
path = g.paths[0][1]
repo = MercurialRepository(os.path.join(path, repo_name), g.baseui)
return repo