Changeset - 0f7355d3c196
[Not reviewed]
beta
0 2 0
Marcin Kuzminski - 13 years ago 2012-08-19 01:02:06
marcin@python-works.com
Load generated revs while switching to other sources of pull-requests.
Issue before was that extra tags or bookmarks weren't present in the dropdown
2 files changed with 17 insertions and 10 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/pullrequests.py
Show inline comments
 
@@ -100,57 +100,63 @@ class PullrequestsController(BaseRepoCon
 
        c.org_repos = []
 
        c.other_repos = []
 
        c.org_repos.append((org_repo.repo_name, '%s/%s' % (
 
                                org_repo.user.username, c.repo_name))
 
                           )
 

	
 
        c.other_refs = c.org_refs
 
        # add org repo to other so we can open pull request agains itself
 
        c.other_repos.extend(c.org_repos)
 

	
 
        c.default_pull_request = org_repo.repo_name
 
        c.default_revs = self._get_repo_refs(org_repo.scm_instance)
 
        #add orginal repo
 
        other_repos_info[org_repo.repo_name] = {
 
            'gravatar': h.gravatar_url(org_repo.user.email, 24),
 
            'description': org_repo.description
 
            'description': org_repo.description,
 
            'revs': h.select('other_ref', '', c.default_revs, class_='refs')
 
        }
 

	
 
        c.default_pull_request = org_repo.repo_name
 
        #gather forks and add to this list
 
        for fork in org_repo.forks:
 
            c.other_repos.append((fork.repo_name, '%s/%s' % (
 
                                    fork.user.username, fork.repo_name))
 
                                 )
 
            other_repos_info[fork.repo_name] = {
 
                'gravatar': h.gravatar_url(fork.user.email, 24),
 
                'description': fork.description
 
                'description': fork.description,
 
                'revs': h.select('other_ref', '',
 
                                 self._get_repo_refs(fork.scm_instance),
 
                                 class_='refs')
 
            }
 
        #add parents of this fork also
 
        if org_repo.parent:
 
            c.default_pull_request = org_repo.parent.repo_name
 
            c.other_repos.append((org_repo.parent.repo_name, '%s/%s' % (
 
                                        org_repo.parent.user.username,
 
                                        org_repo.parent.repo_name))
 
                                     )
 
            other_repos_info[org_repo.parent.repo_name] = {
 
                'gravatar': h.gravatar_url(org_repo.parent.user.email, 24),
 
                'description': org_repo.parent.description
 
                'description': org_repo.parent.description,
 
                'revs': h.select('other_ref', '',
 
                                 self._get_repo_refs(org_repo.parent.scm_instance),
 
                                 class_='refs')
 
            }
 

	
 
        c.other_repos_info = json.dumps(other_repos_info)
 
        c.review_members = [org_repo.user]
 
        return render('/pullrequests/pullrequest.html')
 

	
 
    @NotAnonymous()
 
    def create(self, repo_name):
 

	
 
        try:
 
            _form = PullRequestForm()().to_python(request.POST)
 
        except formencode.Invalid, errors:
 
            log.error(traceback.format_exc())
 
            if errors.error_dict.get('revisions'):
 
                msg = _('Cannot open a pull request with '
 
                        'empty list of changesets')
 
                msg = 'Revisions: %s' % errors.error_dict['revisions']
 
            elif errors.error_dict.get('pullrequest_title'):
 
                msg = _('Pull request requires a title with min. 3 chars')
 
            else:
 
                msg = _('error during creation of pull request')
 

	
 
            h.flash(msg, 'error')
 
@@ -212,13 +218,13 @@ class PullrequestsController(BaseRepoCon
 

	
 
        other_repo = pull_request.other_repo
 
        (other_ref_type,
 
         other_ref_name,
 
         other_ref_rev) = pull_request.other_ref.split(':')
 

	
 
        # dispite opening revisions for bookmarks/branches/tags, we always
 
        # despite opening revisions for bookmarks/branches/tags, we always
 
        # convert this to rev to prevent changes after book or branch change
 
        org_ref = ('rev', org_ref_rev)
 
        other_ref = ('rev', other_ref_rev)
 

	
 
        c.org_repo = org_repo
 
        c.other_repo = other_repo
rhodecode/templates/pullrequests/pullrequest.html
Show inline comments
 
@@ -50,13 +50,13 @@
 
        <div style="float:left">
 
            <div class="fork_user">
 
                <div class="gravatar">
 
                    <img id="other_repo_gravatar" alt="gravatar" src=""/>
 
                </div>
 
                <span style="font-size: 20px">
 
                ${h.select('other_repo',c.default_pull_request ,c.other_repos,class_='refs')}:${h.select('other_ref','',c.other_refs,class_='refs')}
 
                ${h.select('other_repo',c.default_pull_request ,c.other_repos,class_='refs')}:${h.select('other_ref','',c.default_revs,class_='refs')}
 
                </span>
 
                 <div id="other_repo_desc" style="padding:5px 3px 3px 42px;"></div>
 
            </div>
 
            <div style="clear:both;padding-top: 10px"></div>
 
        </div>
 
       <div style="clear:both;padding-top: 10px"></div>
 
@@ -171,12 +171,13 @@
 
    	  var sel_box = YUQ('#pull_request_form #other_repo')[0];
 
    	  var repo_name = sel_box.options[sel_box.selectedIndex].value;
 
    	  YUD.get('pull_request_overview_url').href = url;
 
    	  YUD.setStyle(YUD.get('pull_request_overview_url').parentElement,'display','');
 
    	  YUD.get('other_repo_gravatar').src = other_repos_info[repo_name]['gravatar'];
 
    	  YUD.get('other_repo_desc').innerHTML = other_repos_info[repo_name]['description'];
 
    	  YUD.get('other_ref').innerHTML = other_repos_info[repo_name]['revs'];
 
      })
 
  }
 
  YUE.on('refresh','click',function(e){
 
     loadPreview()
 
  })
 

	
0 comments (0 inline, 0 general)