changeset 4368:3136811db1af

compare: introduce .cs_repo as the repo for .cs_changes - sometimes it is org, sometimes other Influences pull request creation, display and compare.
author Mads Kiilerich <madski@unity3d.com>
date Fri, 18 Jul 2014 19:22:01 +0200
parents 7879d8d88672
children c7570745a2ea
files kallithea/controllers/changeset.py kallithea/controllers/compare.py kallithea/controllers/pullrequests.py kallithea/templates/changeset/changeset_range.html kallithea/templates/compare/compare_cs.html
diffstat 5 files changed, 13 insertions(+), 10 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 18 19:22:01 2014 +0200
@@ -192,6 +192,7 @@
         #get ranges of revisions if preset
         rev_range = revision.split('...')[:2]
         enable_comments = True
+        c.cs_repo = c.db_repo
         try:
             if len(rev_range) == 2:
                 enable_comments = False
--- a/kallithea/controllers/compare.py	Fri Jul 04 14:12:06 2014 +0200
+++ b/kallithea/controllers/compare.py	Fri Jul 18 19:22:01 2014 +0200
@@ -219,6 +219,7 @@
         c.org_ref_type = org_ref_type
         c.other_ref_type = other_ref_type
 
+        c.cs_repo = other_repo
         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)
--- a/kallithea/controllers/pullrequests.py	Fri Jul 04 14:12:06 2014 +0200
+++ b/kallithea/controllers/pullrequests.py	Fri Jul 18 19:22:01 2014 +0200
@@ -199,6 +199,7 @@
          c.other_rev) = pull_request.other_ref.split(':')
 
         org_scm_instance = c.org_repo.scm_instance # property with expensive cache invalidation check!!!
+        c.cs_repo = c.org_repo
         c.cs_ranges = [org_scm_instance.get_changeset(x) for x in pull_request.revisions]
         c.cs_ranges_org = None # not stored and not important and moving target - could be calculated ...
         revs = [ctx.revision for ctx in reversed(c.cs_ranges)]
--- a/kallithea/templates/changeset/changeset_range.html	Fri Jul 04 14:12:06 2014 +0200
+++ b/kallithea/templates/changeset/changeset_range.html	Fri Jul 18 19:22:01 2014 +0200
@@ -43,7 +43,7 @@
             %for cnt,cs in enumerate(c.cs_ranges):
                 <tr>
                 <td><div class="gravatar"><img alt="gravatar" src="${h.gravatar_url(h.email_or_none(cs.author),14)}"/></div></td>
-                <td>${h.link_to('r%s:%s' % (cs.revision,h.short_id(cs.raw_id)),h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}</td>
+                <td>${h.link_to('r%s:%s' % (cs.revision,h.short_id(cs.raw_id)),h.url('changeset_home',repo_name=c.cs_repo.repo_name,revision=cs.raw_id))}</td>
                 <td><div class="author">${h.person(cs.author)}</div></td>
                 <td><span class="tooltip" title="${h.age(cs.date)}">${cs.date}</span></td>
                 <td>
@@ -59,7 +59,7 @@
             <div style="font-size:1.1em;font-weight: bold;clear:both;padding-top:10px">${_('Files affected')}</div>
             <div class="cs_files">
                 %for cs in c.cs_ranges:
-                    <div class="cur_cs">${h.link_to(h.show_id(cs),h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}</div>
+                    <div class="cur_cs">${h.link_to(h.show_id(cs),h.url('changeset_home',repo_name=c.cs_repo.repo_name,revision=cs.raw_id))}</div>
                     %for FID, (cs1, cs2, change, path, diff, stats) in c.changes[cs.raw_id].iteritems():
                         <div class="cs_${change}">
                             <div class="node">
@@ -79,7 +79,7 @@
           ##${comment.comment_inline_form(cs)}
           ## diff block
           <div class="h3">
-          <a class="tooltip" title="${h.tooltip(cs.message)}" href="${h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id)}">${h.show_id(cs)}</a>
+          <a class="tooltip" title="${h.tooltip(cs.message)}" href="${h.url('changeset_home',repo_name=c.cs_repo.repo_name,revision=cs.raw_id)}">${h.show_id(cs)}</a>
              <div class="gravatar">
                  <img alt="gravatar" src="${h.gravatar_url(h.email_or_none(cs.author),20)}"/>
              </div>
@@ -91,17 +91,17 @@
                 %if h.is_hg(c.db_repo_scm_instance):
                   %for book in cs.bookmarks:
                   <span class="booktag" title="${_('Bookmark %s') % book}">
-                     ${h.link_to(book,h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}
+                     ${h.link_to(book,h.url('changeset_home',repo_name=c.cs_repo.repo_name,revision=cs.raw_id))}
                   </span>
                   %endfor
                 %endif
                 %for tag in cs.tags:
                     <span class="tagtag" title="${_('Tag %s') % tag}">
-                    ${h.link_to(tag,h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}</span>
+                    ${h.link_to(tag,h.url('changeset_home',repo_name=c.cs_repo.repo_name,revision=cs.raw_id))}</span>
                 %endfor
                 %if cs.branch:
                 <span class="branchtag" title="${_('Branch %s') % cs.branch}">
-                   ${h.link_to(cs.branch,h.url('changeset_home',repo_name=c.repo_name,revision=cs.raw_id))}
+                   ${h.link_to(cs.branch,h.url('changeset_home',repo_name=c.cs_repo.repo_name,revision=cs.raw_id))}
                 </span>
                 %endif
               </span>
--- a/kallithea/templates/compare/compare_cs.html	Fri Jul 04 14:12:06 2014 +0200
+++ b/kallithea/templates/compare/compare_cs.html	Fri Jul 18 19:22:01 2014 +0200
@@ -28,7 +28,7 @@
           %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)}">
+                      <a href="${h.url('changeset_home',repo_name=c.cs_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>
@@ -39,10 +39,10 @@
         <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>
         <td><div class="author">${h.person(cs.author)}</div></td>
-        <td>${h.link_to(h.show_id(cs),h.url('changeset_home',repo_name=c.other_repo.repo_name,revision=cs.raw_id))}</td>
+        <td>${h.link_to(h.show_id(cs),h.url('changeset_home',repo_name=c.cs_repo.repo_name,revision=cs.raw_id))}</td>
         <td>
         %if cs.branch:
-        <span class="branchtag">${h.link_to(cs.branch,h.url('changelog_home',repo_name=c.other_repo.repo_name,branch=cs.branch))}</span>
+        <span class="branchtag">${h.link_to(cs.branch,h.url('changelog_home',repo_name=c.cs_repo.repo_name,branch=cs.branch))}</span>
         %endif
         </td>
         <td class="expand_commit" commit_id="${cs.raw_id}" title="${_('Expand commit message')}">
@@ -116,4 +116,4 @@
         });
     });
 
-</script>
\ No newline at end of file
+</script>