@@ -210,7 +210,8 @@ class CompareController(BaseRepoControll
h.flash(msg, category='error')
return redirect(url('compare_home', repo_name=c.repo_name))
c.a_rev = self._get_ref_rev(org_repo, org_ref_type, org_ref_name)
c.a_rev = self._get_ref_rev(org_repo, org_ref_type, org_ref_name,
returnempty=True)
c.cs_rev = self._get_ref_rev(other_repo, other_ref_type, other_ref_name)
c.compare_home = False
@@ -580,7 +580,10 @@ class PullrequestsController(BaseRepoCon
c.cs_branch_name = org_scm_instance.get_changeset(c.cs_ref_name).branch # use ref_type ?
other_branch_name = c.a_ref_name
if c.a_ref_type != 'branch':
other_branch_name = other_scm_instance.get_changeset(c.a_ref_name).branch # use ref_type ?
try:
except EmptyRepositoryError:
other_branch_name = 'null' # not a branch name ... but close enough
# candidates: descendants of old head that are on the right branch
# and not are the old head itself ...
# and nothing at all if old head is a descendent of target ref name
@@ -436,7 +436,7 @@ class BaseRepoController(BaseController)
c.repo_name, self.authuser.user_id)
@staticmethod
def _get_ref_rev(repo, ref_type, ref_name):
def _get_ref_rev(repo, ref_type, ref_name, returnempty=False):
"""
Safe way to get changeset. If error occurs show error.
@@ -444,6 +444,8 @@ class BaseRepoController(BaseController)
return repo.scm_instance.get_ref_revision(ref_type, ref_name)
except EmptyRepositoryError as e:
if returnempty:
return repo.scm_instance.EMPTY_CHANGESET
h.flash(h.literal(_('There are no changesets yet')),
category='error')
raise webob.exc.HTTPNotFound()
Status change: