Mercurial > kallithea
comparison pylons_app/model/hg_model.py @ 80:928416088790
reimplemented summary page,
added few filters, removed age from models and made it as filter.
author | Marcin Kuzminski <marcin@python-blog.com> |
---|---|
date | Sat, 17 Apr 2010 22:17:17 +0200 |
parents | cdf4fda66dd9 |
children | 670713507d03 |
comparison
equal
deleted
inserted
replaced
79:9fe23fdab9e9 | 80:928416088790 |
---|---|
13 from pylons.controllers.util import abort | 13 from pylons.controllers.util import abort |
14 try: | 14 try: |
15 from vcs.backends.hg import get_repositories, MercurialRepository | 15 from vcs.backends.hg import get_repositories, MercurialRepository |
16 except ImportError: | 16 except ImportError: |
17 print 'You have to import vcs module' | 17 print 'You have to import vcs module' |
18 from mercurial.templatefilters import age | |
19 | 18 |
20 class HgModel(object): | 19 class HgModel(object): |
21 """ | 20 """ |
22 Mercurial Model | 21 Mercurial Model |
23 """ | 22 """ |
41 tmp_d = {} | 40 tmp_d = {} |
42 tmp_d['name'] = mercurial_repo.name | 41 tmp_d['name'] = mercurial_repo.name |
43 tmp_d['name_sort'] = tmp_d['name'] | 42 tmp_d['name_sort'] = tmp_d['name'] |
44 tmp_d['description'] = mercurial_repo.description | 43 tmp_d['description'] = mercurial_repo.description |
45 tmp_d['description_sort'] = tmp_d['description'] | 44 tmp_d['description_sort'] = tmp_d['description'] |
46 tmp_d['last_change'] = age(last_change) | 45 tmp_d['last_change'] = last_change |
47 tmp_d['last_change_sort'] = last_change[1] - last_change[0] | 46 tmp_d['last_change_sort'] = last_change[1] - last_change[0] |
48 tmp_d['tip'] = str(tip) | 47 tmp_d['tip'] = str(tip) |
49 tmp_d['tip_sort'] = tip.rev() | 48 tmp_d['tip_sort'] = tip.rev() |
50 tmp_d['rev'] = tip.rev() | 49 tmp_d['rev'] = tip.rev() |
51 tmp_d['contact'] = mercurial_repo.contact | 50 tmp_d['contact'] = mercurial_repo.contact |
53 tmp_d['repo_archives'] = mercurial_repo._get_archive_list() | 52 tmp_d['repo_archives'] = mercurial_repo._get_archive_list() |
54 | 53 |
55 yield tmp_d | 54 yield tmp_d |
56 | 55 |
57 def get_repo(self, repo_name): | 56 def get_repo(self, repo_name): |
58 path = g.paths[0][1] | 57 path = g.paths[0][1].replace('*', '') |
59 repo = MercurialRepository(os.path.join(path, repo_name), g.baseui) | 58 repo = MercurialRepository(os.path.join(path, repo_name), baseui=g.baseui) |
60 return repo | 59 return repo |