Show More
@@ -15,8 +15,6 b' try:' | |||
|
15 | 15 | from vcs.backends.hg import get_repositories |
|
16 | 16 | except ImportError: |
|
17 | 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 | 18 | from mercurial.templatefilters import age |
|
21 | 19 | |
|
22 | 20 | class HgModel(object): |
@@ -29,39 +27,29 b' class HgModel(object):' | |||
|
29 | 27 | """ |
|
30 | 28 | Constructor |
|
31 | 29 | """ |
|
32 | ||
|
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} | |
|
30 | pass | |
|
48 | 31 | |
|
49 | 32 | def get_repos(self): |
|
50 |
for |
|
|
51 | last_change = (self.get_mtime(r.spath), makedate()[1]) | |
|
52 | tip = r.changectx('tip') | |
|
33 | for mercurial_repo in get_repositories(g.paths[0][0], g.paths[0][1], g.baseui): | |
|
34 | ||
|
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 | 41 | tmp_d = {} |
|
54 | tmp_d['name'] = name | |
|
42 | tmp_d['name'] = mercurial_repo.name | |
|
55 | 43 | tmp_d['name_sort'] = tmp_d['name'] |
|
56 |
tmp_d['description'] = r. |
|
|
44 | tmp_d['description'] = mercurial_repo.description | |
|
57 | 45 | tmp_d['description_sort'] = tmp_d['description'] |
|
58 | 46 | tmp_d['last_change'] = age(last_change) |
|
59 | 47 | tmp_d['last_change_sort'] = last_change[1] - last_change[0] |
|
60 | 48 | tmp_d['tip'] = str(tip) |
|
61 | 49 | tmp_d['tip_sort'] = tip.rev() |
|
62 | 50 | tmp_d['rev'] = tip.rev() |
|
63 |
tmp_d['contact'] = |
|
|
64 |
tmp_d['contact_sort'] = |
|
|
65 |
tmp_d['repo_archives'] = |
|
|
51 | tmp_d['contact'] = mercurial_repo.contact | |
|
52 | tmp_d['contact_sort'] = tmp_d['contact'] | |
|
53 | tmp_d['repo_archives'] = mercurial_repo._get_archive_list() | |
|
66 | 54 | |
|
67 | 55 | yield tmp_d |
General Comments 0
You need to be logged in to leave comments.
Login now