changeset 4367:7879d8d88672

pull requests: show changeset comment and status flags in the changelog for PRs
author Mads Kiilerich <madski@unity3d.com>
date Fri, 04 Jul 2014 14:12:06 +0200
parents cc5300a1f2ac
children 3136811db1af
files kallithea/controllers/changeset.py kallithea/controllers/compare.py kallithea/controllers/pullrequests.py kallithea/public/css/style.css kallithea/templates/compare/compare_cs.html
diffstat 5 files changed, 21 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/controllers/changeset.py	Fri Jul 04 14:12:06 2014 +0200
+++ b/kallithea/controllers/changeset.py	Fri Jul 04 14:12:06 2014 +0200
@@ -312,6 +312,7 @@
                 return render('changeset/changeset.html')
             else:
                 c.cs_ranges_org = None
+                c.cs_comments = {}
                 revs = [ctx.revision for ctx in reversed(c.cs_ranges)]
                 c.jsdata = json.dumps(graph_data(c.db_repo_scm_instance, revs))
                 return render('changeset/changeset_range.html')
--- a/kallithea/controllers/compare.py	Fri Jul 04 14:12:06 2014 +0200
+++ b/kallithea/controllers/compare.py	Fri Jul 04 14:12:06 2014 +0200
@@ -222,15 +222,13 @@
         c.cs_ranges, c.cs_ranges_org, c.ancestor = self._get_changesets(
             org_repo.scm_instance.alias, org_repo.scm_instance, c.org_rev,
             other_repo.scm_instance, c.other_rev)
-        c.statuses = c.db_repo.statuses(
-            [x.raw_id for x in c.cs_ranges])
+        raw_ids = [x.raw_id for x in c.cs_ranges]
+        c.cs_comments = other_repo.get_comments(raw_ids)
+        c.statuses = other_repo.statuses(raw_ids)
 
         revs = [ctx.revision for ctx in reversed(c.cs_ranges)]
         c.jsdata = json.dumps(graph_data(c.other_repo.scm_instance, revs))
 
-        c.statuses = c.db_repo.statuses([x.raw_id for x in
-                                                   c.cs_ranges])
-
         if partial:
             return render('compare/compare_cs.html')
         if merge and c.ancestor:
--- a/kallithea/controllers/pullrequests.py	Fri Jul 04 14:12:06 2014 +0200
+++ b/kallithea/controllers/pullrequests.py	Fri Jul 04 14:12:06 2014 +0200
@@ -204,7 +204,9 @@
         revs = [ctx.revision for ctx in reversed(c.cs_ranges)]
         c.jsdata = json.dumps(graph_data(org_scm_instance, revs))
 
-        c.statuses = c.org_repo.statuses([x.raw_id for x in c.cs_ranges])
+        raw_ids = [x.raw_id for x in c.cs_ranges]
+        c.cs_comments = c.org_repo.get_comments(raw_ids)
+        c.statuses = c.org_repo.statuses(raw_ids)
 
         ignore_whitespace = request.GET.get('ignorews') == '1'
         line_context = request.GET.get('context', 3)
--- a/kallithea/public/css/style.css	Fri Jul 04 14:12:06 2014 +0200
+++ b/kallithea/public/css/style.css	Fri Jul 04 14:12:06 2014 +0200
@@ -2657,6 +2657,8 @@
     height: 41px;
 }
 
+#pull_request_overview .comments-container,
+#changeset_compare_view_content .comments-container,
 #graph_content .comments-container,
 #shortlog_data .comments-container,
 #graph_content .logtags {
@@ -2761,13 +2763,14 @@
     padding: 3px 0;
 }
 
+#pull_request_overview .comments-cnt a,
+#changeset_compare_view_content .comments-cnt a,
 #graph_content .comments-cnt a,
 #shortlog_data .comments-cnt a {
     background-image: url('../images/icons/comments.png');
     background-repeat: no-repeat;
     background-position: 100% 50%;
     padding: 5px 0;
-    padding-right: 20px;
 }
 
 .right .changes {
--- a/kallithea/templates/compare/compare_cs.html	Fri Jul 04 14:12:06 2014 +0200
+++ b/kallithea/templates/compare/compare_cs.html	Fri Jul 04 14:12:06 2014 +0200
@@ -25,6 +25,16 @@
                 <img height="16" width="16" src="${h.url('/images/icons/flag_status_%s.png' % c.statuses[cs.raw_id][0])}" />
             </div>
           %endif
+          %if c.cs_comments.get(cs.raw_id):
+              <div class="comments-container">
+                  <div class="comments-cnt" title="${_('Changeset has comments')}">
+                      <a href="${h.url('changeset_home',repo_name=c.other_repo.repo_name,revision=cs.raw_id,anchor='comment-%s' % c.cs_comments[cs.raw_id][0].comment_id)}">
+                          ${len(c.cs_comments[cs.raw_id])}
+                          <i class="icon-comment-alt icon-comment-colored"></i>
+                      </a>
+                  </div>
+              </div>
+          %endif
         </td>
         <td style="width: 140px"><span class="tooltip" title="${h.tooltip(h.age(cs.date))}">${cs.date}</span></td>
         <td><div class="gravatar" commit_id="${cs.raw_id}"><img alt="gravatar" src="${h.gravatar_url(h.email_or_none(cs.author),14)}" height="14" width="14"/></div></td>