Changeset - 7d47e91dc1aa
[Not reviewed]
beta
0 2 0
Mads Kiilerich - 13 years ago 2013-03-26 01:23:35
madski@unity3d.com
pullrequests: use default_other_repo_info for the default other_ref selector
2 files changed with 5 insertions and 7 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/pullrequests.py
Show inline comments
 
@@ -143,58 +143,56 @@ class PullrequestsController(BaseRepoCon
 

	
 
        other_repos_info = {}
 

	
 
        c.org_repos = []
 
        c.org_repos.append((org_repo.repo_name, org_repo.repo_name))
 
        c.default_org_repo = org_repo.repo_name
 
        c.org_refs, c.default_org_ref = self._get_repo_refs(org_repo.scm_instance, org_rev)
 

	
 
        c.other_repos = []
 
        # add org repo to other so we can open pull request against itself
 
        c.other_repos.extend(c.org_repos)
 
        c.default_other_repo = org_repo.repo_name
 
        c.default_other_refs, c.default_other_ref = self._get_repo_refs(org_repo.scm_instance, branch_rev=org_rev)
 
        other_refs, other_ref = self._get_repo_refs(org_repo.scm_instance, branch_rev=org_rev)
 
        usr_data = lambda usr: dict(user_id=usr.user_id,
 
                                    username=usr.username,
 
                                    firstname=usr.firstname,
 
                                    lastname=usr.lastname,
 
                                    gravatar_link=h.gravatar_url(usr.email, 14))
 
        other_repos_info[org_repo.repo_name] = {
 
            'user': usr_data(org_repo.user),
 
            'description': org_repo.description,
 
            'revs': h.select('other_ref', c.default_other_ref,
 
                             c.default_other_refs, class_='refs')
 
            'revs': h.select('other_ref', other_ref, other_refs, class_='refs')
 
        }
 

	
 
        # gather forks and add to this list ... even though it is rare to
 
        # request forks to pull from their parent
 
        for fork in org_repo.forks:
 
            c.other_repos.append((fork.repo_name, fork.repo_name))
 
            refs, default_ref = self._get_repo_refs(fork.scm_instance)
 
            other_repos_info[fork.repo_name] = {
 
                'user': usr_data(fork.user),
 
                'description': fork.description,
 
                'revs': h.select('other_ref', default_ref, refs, class_='refs')
 
            }
 

	
 
        # add parents of this fork also, but only if it's not empty
 
        if org_repo.parent and org_repo.parent.scm_instance.revisions:
 
            c.default_other_repo = org_repo.parent.repo_name
 
            c.default_other_refs, c.default_other_ref = self._get_repo_refs(org_repo.parent.scm_instance)
 
            other_refs, other_ref = self._get_repo_refs(org_repo.parent.scm_instance)
 
            c.other_repos.append((org_repo.parent.repo_name, org_repo.parent.repo_name))
 
            other_repos_info[org_repo.parent.repo_name] = {
 
                'user': usr_data(org_repo.parent.user),
 
                'description': org_repo.parent.description,
 
                'revs': h.select('other_ref', c.default_other_ref,
 
                                 c.default_other_refs, class_='refs')
 
                'revs': h.select('other_ref', other_ref, other_refs, class_='refs')
 
            }
 

	
 
        c.default_other_repo_info = other_repos_info[c.default_other_repo]
 
        c.other_repos_info = json.dumps(other_repos_info)
 
        return render('/pullrequests/pullrequest.html')
 

	
 
    @NotAnonymous()
 
    def create(self, repo_name):
 
        repo = RepoModel()._get_repo(repo_name)
 
        try:
 
            _form = PullRequestForm(repo.repo_id)().to_python(request.POST)
 
        except formencode.Invalid, errors:
rhodecode/templates/pullrequests/pullrequest.html
Show inline comments
 
@@ -30,25 +30,25 @@ ${self.context_bar('showpullrequest')}
 
                 <div style="padding:5px 3px 3px 20px;">${c.rhodecode_db_repo.description}</div>
 
            </div>
 
            <div style="clear:both;padding-top: 10px"></div>
 
        </div>
 
          <div style="float:left;font-size:24px;padding:0px 20px">
 
          <img height=32 width=32 src="${h.url('/images/arrow_right_64.png')}"/>
 
          </div>
 

	
 
        ##OTHER, most Probably the PARENT OF THIS FORK
 
        <div style="float:left">
 
            <div>
 
                <span style="font-size: 20px">
 
                ${h.select('other_repo',c.default_other_repo,c.other_repos,class_='refs')}:${h.select('other_ref',c.default_other_ref,c.default_other_refs,class_='refs')}
 
                ${h.select('other_repo',c.default_other_repo,c.other_repos,class_='refs')}:${c.default_other_repo_info['revs']}
 
                </span>
 
                 <div id="other_repo_desc" style="padding:5px 3px 3px 20px;"></div>
 
            </div>
 
            <div style="clear:both;padding-top: 10px"></div>
 
        </div>
 
       <div style="clear:both;padding-top: 10px"></div>
 
       ## overview pulled by ajax
 
       <div style="float:left" id="pull_request_overview"></div>
 
       <div style="float:left;clear:both;padding:10px 10px 10px 0px;display:none">
 
            <a id="pull_request_overview_url" href="#">${_('Detailed compare view')}</a>
 
       </div>
 
     </div>
0 comments (0 inline, 0 general)