Changeset - ac752047284f
[Not reviewed]
default
0 3 0
Mads Kiilerich - 11 years ago 2014-09-08 13:38:56
madski@unity3d.com
pull requests: handle pull requests to empty repos (Issue #27)
3 files changed with 9 insertions and 3 deletions:
0 comments (0 inline, 0 general)
kallithea/controllers/compare.py
Show inline comments
 
@@ -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
kallithea/controllers/pullrequests.py
Show inline comments
 
@@ -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:
 
                    other_branch_name = other_scm_instance.get_changeset(c.a_ref_name).branch # use ref_type ?
 
                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
kallithea/lib/base.py
Show inline comments
 
@@ -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)
 
        try:
 
            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()
0 comments (0 inline, 0 general)