Mercurial > kallithea
comparison pylons_app/model/hg_model.py @ 95:a214462101d2
Change logic for more vcs based.
author | Marcin Kuzminski <marcin@python-works.com> |
---|---|
date | Sat, 24 Apr 2010 17:15:57 +0200 |
parents | aec4c0071cb3 |
children | 36102488d634 |
comparison
equal
deleted
inserted
replaced
94:0bb9391bc287 | 95:a214462101d2 |
---|---|
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 raise | 18 raise Exception('Unable to import vcs') |
19 | 19 |
20 class HgModel(object): | 20 class HgModel(object): |
21 """ | 21 """ |
22 Mercurial Model | 22 Mercurial Model |
23 """ | 23 """ |
35 if mercurial_repo._get_hidden(): | 35 if mercurial_repo._get_hidden(): |
36 #skip hidden web repository | 36 #skip hidden web repository |
37 continue | 37 continue |
38 | 38 |
39 last_change = mercurial_repo.last_change | 39 last_change = mercurial_repo.last_change |
40 tip = mercurial_repo.repo.changectx('tip') | 40 tip_rev = mercurial_repo._get_revision('tip') |
41 tip = mercurial_repo.get_changeset(tip_rev) | |
41 tmp_d = {} | 42 tmp_d = {} |
42 tmp_d['name'] = mercurial_repo.name | 43 tmp_d['name'] = mercurial_repo.name |
43 tmp_d['name_sort'] = tmp_d['name'] | 44 tmp_d['name_sort'] = tmp_d['name'] |
44 tmp_d['description'] = mercurial_repo.description | 45 tmp_d['description'] = mercurial_repo.description |
45 tmp_d['description_sort'] = tmp_d['description'] | 46 tmp_d['description_sort'] = tmp_d['description'] |
46 tmp_d['last_change'] = last_change | 47 tmp_d['last_change'] = last_change |
47 tmp_d['last_change_sort'] = last_change[1] - last_change[0] | 48 tmp_d['last_change_sort'] = last_change[1] - last_change[0] |
48 tmp_d['tip'] = str(tip) | 49 tmp_d['tip'] = tip._short |
49 tmp_d['tip_sort'] = tip.rev() | 50 tmp_d['tip_sort'] = tip_rev |
50 tmp_d['rev'] = tip.rev() | 51 tmp_d['rev'] = tip_rev |
51 tmp_d['contact'] = mercurial_repo.contact | 52 tmp_d['contact'] = mercurial_repo.contact |
52 tmp_d['contact_sort'] = tmp_d['contact'] | 53 tmp_d['contact_sort'] = tmp_d['contact'] |
53 tmp_d['repo_archives'] = list(mercurial_repo._get_archives()) | 54 tmp_d['repo_archives'] = list(mercurial_repo._get_archives()) |
54 | 55 |
55 yield tmp_d | 56 yield tmp_d |