##// END OF EJS Templates
Change logic for more vcs based.
marcink -
r95:a2144621 default
parent child Browse files
Show More
@@ -1,60 +1,61 b''
1 1 #!/usr/bin/env python
2 2 # encoding: utf-8
3 3 #
4 4 # Copyright (c) 2010 marcink. All rights reserved.
5 5 #
6 6 '''
7 7 Created on Apr 9, 2010
8 8
9 9 @author: marcink
10 10 '''
11 11 import os
12 12 from pylons import tmpl_context as c, app_globals as g, session, request, config
13 13 from pylons.controllers.util import abort
14 14 try:
15 15 from vcs.backends.hg import get_repositories, MercurialRepository
16 16 except ImportError:
17 17 print 'You have to import vcs module'
18 raise
18 raise Exception('Unable to import vcs')
19 19
20 20 class HgModel(object):
21 21 """
22 22 Mercurial Model
23 23 """
24 24
25 25
26 26 def __init__(self):
27 27 """
28 28 Constructor
29 29 """
30 30 pass
31 31
32 32 def get_repos(self):
33 33 for mercurial_repo in get_repositories(g.paths[0][0], g.paths[0][1], g.baseui):
34 34
35 35 if mercurial_repo._get_hidden():
36 36 #skip hidden web repository
37 37 continue
38 38
39 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 42 tmp_d = {}
42 43 tmp_d['name'] = mercurial_repo.name
43 44 tmp_d['name_sort'] = tmp_d['name']
44 45 tmp_d['description'] = mercurial_repo.description
45 46 tmp_d['description_sort'] = tmp_d['description']
46 47 tmp_d['last_change'] = last_change
47 48 tmp_d['last_change_sort'] = last_change[1] - last_change[0]
48 tmp_d['tip'] = str(tip)
49 tmp_d['tip_sort'] = tip.rev()
50 tmp_d['rev'] = tip.rev()
49 tmp_d['tip'] = tip._short
50 tmp_d['tip_sort'] = tip_rev
51 tmp_d['rev'] = tip_rev
51 52 tmp_d['contact'] = mercurial_repo.contact
52 53 tmp_d['contact_sort'] = tmp_d['contact']
53 54 tmp_d['repo_archives'] = list(mercurial_repo._get_archives())
54 55
55 56 yield tmp_d
56 57
57 58 def get_repo(self, repo_name):
58 59 path = g.paths[0][1].replace('*', '')
59 60 repo = MercurialRepository(os.path.join(path, repo_name), baseui=g.baseui)
60 61 return repo
General Comments 0
You need to be logged in to leave comments. Login now