Commits

Marcin Kuzminski  committed 0f7355d

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

  • Participants
  • Parent commits 2e7f756

Comments (0)

Files changed (2)

File rhodecode/controllers/pullrequests.py

                                 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' % (
                                  )
             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:
                                      )
             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)
 
     @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:
          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)

File rhodecode/templates/pullrequests/pullrequest.html

                     <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>
     	  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){