Changeset - 67d5afe2fa1a
[Not reviewed]
default
0 3 0
Mads Kiilerich - 12 years ago 2013-12-10 19:30:37
madski@unity3d.com
pull requests: show graph when creating PR
3 files changed with 18 insertions and 3 deletions:
0 comments (0 inline, 0 general)
kallithea/controllers/compare.py
Show inline comments
 
@@ -44,12 +44,14 @@ from kallithea.lib.base import BaseRepoC
 
from kallithea.lib.auth import LoginRequired, HasRepoPermissionAnyDecorator
 
from kallithea.lib import diffs
 
from kallithea.model.db import Repository
 
from kallithea.lib.diffs import LimitedDiffContainer
 
from kallithea.controllers.changeset import anchor_url, _ignorews_url,\
 
    _context_url, get_line_ctx, get_ignore_ws
 
from kallithea.lib.graphmod import graph_data
 
from kallithea.lib.compat import json
 

	
 
log = logging.getLogger(__name__)
 

	
 

	
 
class CompareController(BaseRepoController):
 

	
 
@@ -268,12 +270,18 @@ class CompareController(BaseRepoControll
 
        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])
 

	
 
        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:
 
            # case we want a simple diff without incoming changesets,
 
            # previewing what will be merged.
 
            # Make the diff on the other repo (which is known to have other_rev)
kallithea/templates/compare/compare_cs.html
Show inline comments
 
@@ -14,13 +14,13 @@
 
        <canvas id="graph_canvas"></canvas>
 
    </div>
 

	
 
    <div id="graph_content_pr" style="margin-left: 100px;">
 

	
 
    <table class="compare_view_commits noborder">
 
    %for cnt, cs in enumerate(c.cs_ranges):
 
    %for cnt, cs in enumerate(reversed(c.cs_ranges)):
 
        <tr id="chg_${cnt+1}">
 
        <td style="width:50px">
 
          %if cs.raw_id in c.statuses:
 
            <div title="${_('Changeset status: %s') % c.statuses[cs.raw_id][1]}" class="changeset-status-ico">
 
                <img height="16" width="16" src="${h.url('/images/icons/flag_status_%s.png' % c.statuses[cs.raw_id][0])}" />
 
            </div>
 
@@ -76,13 +76,15 @@
 
        ${h.link_to_ref(c.org_repo.repo_name, c.org_ref_type, c.org_ref_name, c.org_rev)}
 
      </div>
 
    %endif
 
  %endif
 
</div>
 

	
 
%if not c.as_form:
 
%if c.as_form:
 
<div id="jsdata" style="display:none">${c.jsdata|n}</div>
 
%else:
 
<script type="text/javascript" src="${h.url('/js/graph.js')}"></script>
 
%endif
 

	
 
<script type="text/javascript">
 

	
 
    $(document).ready(function(){
kallithea/templates/pullrequests/pullrequest.html
Show inline comments
 
@@ -134,12 +134,13 @@ ${self.repo_context_bar('showpullrequest
 
    </div>
 

	
 
    ${h.end_form()}
 

	
 
</div>
 

	
 
<script type="text/javascript" src="${h.url('/js/graph.js')}"></script>
 
<script type="text/javascript">
 
  var _USERS_AC_DATA = ${c.users_array|n};
 
  var _GROUPS_AC_DATA = ${c.user_groups_array|n};
 
  PullRequestAutoComplete('user', 'reviewers_container', _USERS_AC_DATA, _GROUPS_AC_DATA);
 

	
 
  var other_repos_info = ${c.other_repos_info|n};
 
@@ -199,13 +200,17 @@ ${self.repo_context_bar('showpullrequest
 

	
 
      for (k in rev_data){
 
          url = url.replace(k,rev_data[k]);
 
      }
 

	
 
      YUD.get('pull_request_overview').innerHTML = "${_('Loading ...')}";
 
      ypjax(url,'pull_request_overview');
 
      ypjax(url,'pull_request_overview', function(o){
 
          var jsdata = eval('('+YUD.get('jsdata').innerHTML+')');
 
          var r = new BranchRenderer('graph_canvas', 'graph_content_pr');
 
          r.render(jsdata,100);
 
      });
 
  }
 

	
 
  ## refresh automatically when something changes (org_repo can't change)
 

	
 
  YUE.on('org_ref', 'change', function(e){
 
     loadPreview();
0 comments (0 inline, 0 general)