Show More
@@ -2,6 +2,16 b'' | |||||
2 | # encoding: utf-8 |
|
2 | # encoding: utf-8 | |
3 | # changeset controller for pylons |
|
3 | # changeset controller for pylons | |
4 | # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> |
|
4 | # Copyright (C) 2009-2010 Marcin Kuzminski <marcin@python-works.com> | |
|
5 | from pylons import tmpl_context as c, url | |||
|
6 | from pylons.controllers.util import redirect | |||
|
7 | from pylons_app.lib.auth import LoginRequired | |||
|
8 | from pylons_app.lib.base import BaseController, render | |||
|
9 | from pylons_app.model.hg_model import HgModel | |||
|
10 | from vcs.exceptions import RepositoryError | |||
|
11 | from vcs.nodes import FileNode | |||
|
12 | from vcs.utils import diffs as differ | |||
|
13 | import logging | |||
|
14 | import traceback | |||
5 |
|
15 | |||
6 | # This program is free software; you can redistribute it and/or |
|
16 | # This program is free software; you can redistribute it and/or | |
7 | # modify it under the terms of the GNU General Public License |
|
17 | # modify it under the terms of the GNU General Public License | |
@@ -22,13 +32,6 b' Created on April 25, 2010' | |||||
22 | changeset controller for pylons |
|
32 | changeset controller for pylons | |
23 | @author: marcink |
|
33 | @author: marcink | |
24 | """ |
|
34 | """ | |
25 | from pylons import tmpl_context as c |
|
|||
26 | from pylons_app.lib.auth import LoginRequired |
|
|||
27 | from pylons_app.lib.base import BaseController, render |
|
|||
28 | from pylons_app.model.hg_model import HgModel |
|
|||
29 | from vcs.utils import diffs as differ |
|
|||
30 | import logging |
|
|||
31 | from vcs.nodes import FileNode |
|
|||
32 |
|
35 | |||
33 |
|
36 | |||
34 | log = logging.getLogger(__name__) |
|
37 | log = logging.getLogger(__name__) | |
@@ -41,11 +44,18 b' class ChangesetController(BaseController' | |||||
41 |
|
44 | |||
42 | def index(self, revision): |
|
45 | def index(self, revision): | |
43 | hg_model = HgModel() |
|
46 | hg_model = HgModel() | |
|
47 | try: | |||
44 | c.changeset = hg_model.get_repo(c.repo_name).get_changeset(revision) |
|
48 | c.changeset = hg_model.get_repo(c.repo_name).get_changeset(revision) | |
|
49 | except RepositoryError: | |||
|
50 | log.error(traceback.format_exc()) | |||
|
51 | return redirect(url('hg_home')) | |||
|
52 | else: | |||
|
53 | try: | |||
45 | c.changeset_old = c.changeset.parents[0] |
|
54 | c.changeset_old = c.changeset.parents[0] | |
|
55 | except IndexError: | |||
|
56 | c.changeset_old = None | |||
46 | c.changes = [] |
|
57 | c.changes = [] | |
47 |
|
58 | |||
48 |
|
||||
49 | for node in c.changeset.added: |
|
59 | for node in c.changeset.added: | |
50 | filenode_old = FileNode(node.path, '') |
|
60 | filenode_old = FileNode(node.path, '') | |
51 | if filenode_old.is_binary or node.is_binary: |
|
61 | if filenode_old.is_binary or node.is_binary: |
@@ -26,7 +26,7 b'' | |||||
26 | <div class="date">${_('Date')}: ${c.changeset.date}</div> |
|
26 | <div class="date">${_('Date')}: ${c.changeset.date}</div> | |
27 | <div class="author">${_('Author')}: ${c.changeset.author}</div> |
|
27 | <div class="author">${_('Author')}: ${c.changeset.author}</div> | |
28 | <div class="message"> |
|
28 | <div class="message"> | |
29 | ${c.changeset.message} |
|
29 | ${h.wrap_paragraphs(c.changeset.message)} | |
30 | </div> |
|
30 | </div> | |
31 | </div> |
|
31 | </div> | |
32 | <div class="right"> |
|
32 | <div class="right"> |
@@ -36,7 +36,7 b'' | |||||
36 | h.url('summary_home',repo_name=repo['name']))}</td> |
|
36 | h.url('summary_home',repo_name=repo['name']))}</td> | |
37 | <td title="${repo['description']}">${h.truncate(repo['description'],60)}</td> |
|
37 | <td title="${repo['description']}">${h.truncate(repo['description'],60)}</td> | |
38 | <td>${h.age(repo['last_change'])}</td> |
|
38 | <td>${h.age(repo['last_change'])}</td> | |
39 | <td>${h.link_to('r%s:%s' % (repo['rev'],repo['tip']), |
|
39 | <td>${h.link_to_if(repo['rev']>=0,'r%s:%s' % (repo['rev'],repo['tip']), | |
40 | h.url('changeset_home',repo_name=repo['name'],revision=repo['tip']), |
|
40 | h.url('changeset_home',repo_name=repo['name'],revision=repo['tip']), | |
41 | class_="tooltip", |
|
41 | class_="tooltip", | |
42 | tooltip_title=h.tooltip(repo['last_msg']))}</td> |
|
42 | tooltip_title=h.tooltip(repo['last_msg']))}</td> |
General Comments 0
You need to be logged in to leave comments.
Login now