Show More
@@ -15,8 +15,6 b' try:' | |||||
15 | from vcs.backends.hg import get_repositories |
|
15 | from vcs.backends.hg import get_repositories | |
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.util import matchdate, Abort, makedate |
|
|||
19 | from mercurial.hgweb.common import get_contact |
|
|||
20 | from mercurial.templatefilters import age |
|
18 | from mercurial.templatefilters import age | |
21 |
|
19 | |||
22 | class HgModel(object): |
|
20 | class HgModel(object): | |
@@ -29,39 +27,29 b' class HgModel(object):' | |||||
29 | """ |
|
27 | """ | |
30 | Constructor |
|
28 | Constructor | |
31 | """ |
|
29 | """ | |
32 |
|
30 | pass | ||
33 |
|
||||
34 | def get_mtime(self, spath): |
|
|||
35 | cl_path = os.path.join(spath, "00changelog.i") |
|
|||
36 | if os.path.exists(cl_path): |
|
|||
37 | return os.stat(cl_path).st_mtime |
|
|||
38 | else: |
|
|||
39 | return os.stat(spath).st_mtime |
|
|||
40 |
|
||||
41 | def archivelist(self, ui, nodeid, url): |
|
|||
42 | allowed = g.baseui.configlist("web", "allow_archive", untrusted=True) |
|
|||
43 | for i in [('zip', '.zip'), ('gz', '.tar.gz'), ('bz2', '.tar.bz2')]: |
|
|||
44 | if i[0] in allowed or ui.configbool("web", "allow" + i[0], |
|
|||
45 | untrusted=True): |
|
|||
46 | yield {"type" : i[0], "extension": i[1], |
|
|||
47 | "node": nodeid, "url": url} |
|
|||
48 |
|
31 | |||
49 | def get_repos(self): |
|
32 | def get_repos(self): | |
50 |
for |
|
33 | for mercurial_repo in get_repositories(g.paths[0][0], g.paths[0][1], g.baseui): | |
51 | last_change = (self.get_mtime(r.spath), makedate()[1]) |
|
34 | ||
52 | tip = r.changectx('tip') |
|
35 | if mercurial_repo._get_hidden(): | |
|
36 | #skip hidden web repository | |||
|
37 | continue | |||
|
38 | ||||
|
39 | last_change = mercurial_repo.last_change | |||
|
40 | tip = mercurial_repo.repo.changectx('tip') | |||
53 | tmp_d = {} |
|
41 | tmp_d = {} | |
54 | tmp_d['name'] = name |
|
42 | tmp_d['name'] = mercurial_repo.name | |
55 | tmp_d['name_sort'] = tmp_d['name'] |
|
43 | tmp_d['name_sort'] = tmp_d['name'] | |
56 |
tmp_d['description'] = r. |
|
44 | tmp_d['description'] = mercurial_repo.description | |
57 | tmp_d['description_sort'] = tmp_d['description'] |
|
45 | tmp_d['description_sort'] = tmp_d['description'] | |
58 | tmp_d['last_change'] = age(last_change) |
|
46 | tmp_d['last_change'] = age(last_change) | |
59 | tmp_d['last_change_sort'] = last_change[1] - last_change[0] |
|
47 | tmp_d['last_change_sort'] = last_change[1] - last_change[0] | |
60 | tmp_d['tip'] = str(tip) |
|
48 | tmp_d['tip'] = str(tip) | |
61 | tmp_d['tip_sort'] = tip.rev() |
|
49 | tmp_d['tip_sort'] = tip.rev() | |
62 | tmp_d['rev'] = tip.rev() |
|
50 | tmp_d['rev'] = tip.rev() | |
63 |
tmp_d['contact'] = |
|
51 | tmp_d['contact'] = mercurial_repo.contact | |
64 |
tmp_d['contact_sort'] = |
|
52 | tmp_d['contact_sort'] = tmp_d['contact'] | |
65 |
tmp_d['repo_archives'] = |
|
53 | tmp_d['repo_archives'] = mercurial_repo._get_archive_list() | |
66 |
|
54 | |||
67 | yield tmp_d |
|
55 | yield tmp_d |
General Comments 0
You need to be logged in to leave comments.
Login now