Show More
@@ -38,6 +38,7 b' from rhodecode.lib.helpers import RepoPa' | |||||
38 | from rhodecode.lib.compat import json |
|
38 | from rhodecode.lib.compat import json | |
39 |
|
39 | |||
40 | from vcs.exceptions import RepositoryError, ChangesetDoesNotExistError |
|
40 | from vcs.exceptions import RepositoryError, ChangesetDoesNotExistError | |
|
41 | from rhodecode.model.db import Repository | |||
41 |
|
42 | |||
42 | log = logging.getLogger(__name__) |
|
43 | log = logging.getLogger(__name__) | |
43 |
|
44 | |||
@@ -75,12 +76,15 b' class ChangelogController(BaseRepoContro' | |||||
75 | branch_name=branch_name)] |
|
76 | branch_name=branch_name)] | |
76 | c.total_cs = len(collection) |
|
77 | c.total_cs = len(collection) | |
77 | else: |
|
78 | else: | |
78 |
collection = |
|
79 | collection = c.rhodecode_repo | |
79 | c.total_cs = len(c.rhodecode_repo) |
|
80 | c.total_cs = len(c.rhodecode_repo) | |
80 |
|
81 | |||
81 |
|
||||
82 | c.pagination = RepoPage(collection, page=p, item_count=c.total_cs, |
|
82 | c.pagination = RepoPage(collection, page=p, item_count=c.total_cs, | |
83 | items_per_page=c.size, branch=branch_name) |
|
83 | items_per_page=c.size, branch=branch_name) | |
|
84 | collection = list(c.pagination) | |||
|
85 | page_revisions = [x.raw_id for x in collection] | |||
|
86 | c.comments = c.rhodecode_db_repo.comments(page_revisions) | |||
|
87 | ||||
84 | except (RepositoryError, ChangesetDoesNotExistError, Exception), e: |
|
88 | except (RepositoryError, ChangesetDoesNotExistError, Exception), e: | |
85 | log.error(traceback.format_exc()) |
|
89 | log.error(traceback.format_exc()) | |
86 | h.flash(str(e), category='warning') |
|
90 | h.flash(str(e), category='warning') | |
@@ -89,9 +93,8 b' class ChangelogController(BaseRepoContro' | |||||
89 | self._graph(c.rhodecode_repo, collection, c.total_cs, c.size, p) |
|
93 | self._graph(c.rhodecode_repo, collection, c.total_cs, c.size, p) | |
90 |
|
94 | |||
91 | c.branch_name = branch_name |
|
95 | c.branch_name = branch_name | |
92 | c.branch_filters = [('',_('All Branches'))] + \ |
|
96 | c.branch_filters = [('', _('All Branches'))] + \ | |
93 | [(k,k) for k in c.rhodecode_repo.branches.keys()] |
|
97 | [(k, k) for k in c.rhodecode_repo.branches.keys()] | |
94 |
|
||||
95 |
|
98 | |||
96 | return render('changelog/changelog.html') |
|
99 | return render('changelog/changelog.html') | |
97 |
|
100 | |||
@@ -112,25 +115,16 b' class ChangelogController(BaseRepoContro' | |||||
112 | c.jsdata = json.dumps([]) |
|
115 | c.jsdata = json.dumps([]) | |
113 | return |
|
116 | return | |
114 |
|
117 | |||
115 | revcount = min(repo_size, size) |
|
|||
116 | offset = 1 if p == 1 else ((p - 1) * revcount + 1) |
|
|||
117 | try: |
|
|||
118 | rev_end = collection.index(collection[(-1 * offset)]) |
|
|||
119 | except IndexError: |
|
|||
120 | rev_end = collection.index(collection[-1]) |
|
|||
121 | rev_start = max(0, rev_end - revcount) |
|
|||
122 |
|
||||
123 | data = [] |
|
118 | data = [] | |
124 | rev_end += 1 |
|
119 | revs = [x.revision for x in collection] | |
125 |
|
120 | |||
126 | if repo.alias == 'git': |
|
121 | if repo.alias == 'git': | |
127 |
for _ in |
|
122 | for _ in revs: | |
128 | vtx = [0, 1] |
|
123 | vtx = [0, 1] | |
129 | edges = [[0, 0, 1]] |
|
124 | edges = [[0, 0, 1]] | |
130 | data.append(['', vtx, edges]) |
|
125 | data.append(['', vtx, edges]) | |
131 |
|
126 | |||
132 | elif repo.alias == 'hg': |
|
127 | elif repo.alias == 'hg': | |
133 | revs = list(reversed(xrange(rev_start, rev_end))) |
|
|||
134 | c.dag = graphmod.colored(graphmod.dagwalker(repo._repo, revs)) |
|
128 | c.dag = graphmod.colored(graphmod.dagwalker(repo._repo, revs)) | |
135 | for (id, type, ctx, vtx, edges) in c.dag: |
|
129 | for (id, type, ctx, vtx, edges) in c.dag: | |
136 | if type != graphmod.CHANGESET: |
|
130 | if type != graphmod.CHANGESET: |
@@ -607,7 +607,6 b' class RepoPage(Page):' | |||||
607 |
|
607 | |||
608 | self.items = list(self.collection[self.first_item:self.last_item + 1]) |
|
608 | self.items = list(self.collection[self.first_item:self.last_item + 1]) | |
609 |
|
609 | |||
610 |
|
||||
611 | # Links to previous and next page |
|
610 | # Links to previous and next page | |
612 | if self.page > self.first_page: |
|
611 | if self.page > self.first_page: | |
613 | self.previous_page = self.page - 1 |
|
612 | self.previous_page = self.page - 1 | |
@@ -791,8 +790,6 b' def urlify_commit(text_, repository=None' | |||||
791 | log.error(traceback.format_exc()) |
|
790 | log.error(traceback.format_exc()) | |
792 | pass |
|
791 | pass | |
793 |
|
792 | |||
794 |
|
||||
795 |
|
||||
796 | return text_ |
|
793 | return text_ | |
797 |
|
794 | |||
798 |
|
795 |
@@ -27,6 +27,7 b' import os' | |||||
27 | import logging |
|
27 | import logging | |
28 | import datetime |
|
28 | import datetime | |
29 | import traceback |
|
29 | import traceback | |
|
30 | from collections import defaultdict | |||
30 |
|
31 | |||
31 | from sqlalchemy import * |
|
32 | from sqlalchemy import * | |
32 | from sqlalchemy.ext.hybrid import hybrid_property |
|
33 | from sqlalchemy.ext.hybrid import hybrid_property | |
@@ -609,6 +610,22 b' class Repository(Base, BaseModel):' | |||||
609 | def last_change(self): |
|
610 | def last_change(self): | |
610 | return self.scm_instance.last_change |
|
611 | return self.scm_instance.last_change | |
611 |
|
612 | |||
|
613 | def comments(self, revisions=None): | |||
|
614 | """ | |||
|
615 | Returns comments for this repository grouped by revisions | |||
|
616 | ||||
|
617 | :param revisions: filter query by revisions only | |||
|
618 | """ | |||
|
619 | cmts = ChangesetComment.query()\ | |||
|
620 | .filter(ChangesetComment.repo == self) | |||
|
621 | if revisions: | |||
|
622 | cmts = cmts.filter(ChangesetComment.revision.in_(revisions)) | |||
|
623 | grouped = defaultdict(list) | |||
|
624 | for cmt in cmts.all(): | |||
|
625 | grouped[cmt.revision].append(cmt) | |||
|
626 | return grouped | |||
|
627 | ||||
|
628 | ||||
612 | #========================================================================== |
|
629 | #========================================================================== | |
613 | # SCM CACHE INSTANCE |
|
630 | # SCM CACHE INSTANCE | |
614 | #========================================================================== |
|
631 | #========================================================================== | |
@@ -1044,7 +1061,7 b' class ChangesetComment(Base, BaseModel):' | |||||
1044 | return Session.query(User)\ |
|
1061 | return Session.query(User)\ | |
1045 | .filter(cls.revision == revision)\ |
|
1062 | .filter(cls.revision == revision)\ | |
1046 | .join(ChangesetComment.author).all() |
|
1063 | .join(ChangesetComment.author).all() | |
1047 |
|
1064 | |||
1048 |
|
1065 | |||
1049 | class Notification(Base, BaseModel): |
|
1066 | class Notification(Base, BaseModel): | |
1050 | __tablename__ = 'notifications' |
|
1067 | __tablename__ = 'notifications' |
@@ -2279,7 +2279,7 b' h3.files_location {' | |||||
2279 |
|
2279 | |||
2280 | #graph_content .container { |
|
2280 | #graph_content .container { | |
2281 | border-bottom: 1px solid #DDD; |
|
2281 | border-bottom: 1px solid #DDD; | |
2282 |
height: 5 |
|
2282 | height: 57px; | |
2283 | overflow: hidden; |
|
2283 | overflow: hidden; | |
2284 | } |
|
2284 | } | |
2285 |
|
2285 | |||
@@ -2330,8 +2330,20 b' h3.files_location {' | |||||
2330 | font-weight: bold !important; |
|
2330 | font-weight: bold !important; | |
2331 | } |
|
2331 | } | |
2332 |
|
2332 | |||
2333 |
|
2333 | .right .comments-container{ | ||
2334 | .right div { |
|
2334 | padding-right: 5px; | |
|
2335 | margin-top:1px; | |||
|
2336 | float:right; | |||
|
2337 | height:16px; | |||
|
2338 | } | |||
|
2339 | ||||
|
2340 | .right .comments-cnt{ | |||
|
2341 | float: left; | |||
|
2342 | color: rgb(136, 136, 136); | |||
|
2343 | padding-right: 2px; | |||
|
2344 | } | |||
|
2345 | ||||
|
2346 | .right .changes{ | |||
2335 | clear: both; |
|
2347 | clear: both; | |
2336 | } |
|
2348 | } | |
2337 |
|
2349 | |||
@@ -2386,6 +2398,7 b' h3.files_location {' | |||||
2386 |
|
2398 | |||
2387 | .right .parent { |
|
2399 | .right .parent { | |
2388 | color: #666666; |
|
2400 | color: #666666; | |
|
2401 | clear:both; | |||
2389 | } |
|
2402 | } | |
2390 | .right .logtags{ |
|
2403 | .right .logtags{ | |
2391 | padding: 2px 2px 2px 2px; |
|
2404 | padding: 2px 2px 2px 2px; |
@@ -64,8 +64,14 b'' | |||||
64 | </div> |
|
64 | </div> | |
65 | <div class="right"> |
|
65 | <div class="right"> | |
66 | <div id="${cs.raw_id}_changes_info" class="changes"> |
|
66 | <div id="${cs.raw_id}_changes_info" class="changes"> | |
67 |
< |
|
67 | <div id="${cs.raw_id}" style="float:right;" class="changed_total tooltip" title="${_('Affected number of files, click to show more details')}">${len(cs.affected_files)}</div> | |
68 | </div> |
|
68 | <div class="comments-container"> | |
|
69 | %if len(c.comments.get(cs.raw_id,[])) > 0: | |||
|
70 | <div class="comments-cnt" title="${('comments')}">${len(c.comments.get(cs.raw_id,[]))}</div> | |||
|
71 | <img src="${h.url('/images/icons/comments.png')}"> | |||
|
72 | %endif | |||
|
73 | </div> | |||
|
74 | </div> | |||
69 | %if cs.parents: |
|
75 | %if cs.parents: | |
70 | %for p_cs in reversed(cs.parents): |
|
76 | %for p_cs in reversed(cs.parents): | |
71 | <div class="parent">${_('Parent')} |
|
77 | <div class="parent">${_('Parent')} |
General Comments 0
You need to be logged in to leave comments.
Login now