Changeset - dca89d578c70
[Not reviewed]
beta
0 2 0
Mads Kiilerich - 13 years ago 2013-04-08 22:29:29
madski@unity3d.com
pull requests: use branch name when creating PRs from a changelog with branch filter
2 files changed with 24 insertions and 8 deletions:
0 comments (0 inline, 0 general)
rhodecode/controllers/pullrequests.py
Show inline comments
 
@@ -68,11 +68,12 @@ class PullrequestsController(BaseRepoCon
 
        c.users_array = repo_model.get_users_js()
 
        c.users_groups_array = repo_model.get_users_groups_js()
 

	
 
    def _get_repo_refs(self, repo, rev=None, branch_rev=None):
 
    def _get_repo_refs(self, repo, rev=None, branch=None, branch_rev=None):
 
        """return a structure with repo's interesting changesets, suitable for
 
        the selectors in pullrequest.html
 

	
 
        rev: a revision that must be in the list and selected by default
 
        rev: a revision that must be in the list somehow and selected by default
 
        branch: a branch that must be in the list and selected by default - even if closed
 
        branch_rev: a revision of which peers should be preferred and available."""
 
        # list named branches that has been merged to this named branch - it should probably merge back
 
        peers = []
 
@@ -80,6 +81,9 @@ class PullrequestsController(BaseRepoCon
 
        if rev:
 
            rev = safe_str(rev)
 

	
 
        if branch:
 
            branch = safe_str(branch)
 

	
 
        if branch_rev:
 
            branch_rev = safe_str(branch_rev)
 
            # not restricting to merge() would also get branch point and be better
 
@@ -102,6 +106,15 @@ class PullrequestsController(BaseRepoCon
 
            branches.append((n, abranch))
 
            if rev == branchrev:
 
                selected = n
 
            if branch == abranch:
 
                selected = n
 
                branch = None
 
        if branch: # branch not in list - it is probably closed
 
            revs = repo._repo.revs('max(branch(%s))', branch)
 
            if revs:
 
                cs = repo.get_changeset(revs[0])
 
                selected = 'branch:%s:%s' % (branch, cs.raw_id)
 
                branches.append((selected, branch))
 

	
 
        bookmarks = []
 
        for bookmark, bookmarkrev in repo.bookmarks.iteritems():
 
@@ -252,11 +265,12 @@ class PullrequestsController(BaseRepoCon
 
        # rev_start is not directly useful - its parent could however be used
 
        # as default for other and thus give a simple compare view
 
        #other_rev = request.POST.get('rev_start')
 
        branch = request.GET.get('branch')
 

	
 
        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.org_refs, c.default_org_ref = self._get_repo_refs(org_repo.scm_instance, rev=org_rev, branch=branch)
 

	
 
        c.other_repos = []
 
        other_repos_info = {}
rhodecode/templates/changelog/changelog.html
Show inline comments
 
@@ -149,7 +149,6 @@ ${self.context_bar('changelog')}
 
                //ranges
 
                var checkboxes = YUD.getElementsByClassName('changeset_range');
 
                var url_tmpl = "${h.url('changeset_home',repo_name=c.repo_name,revision='__REVRANGE__')}";
 
                var pr_tmpl = "${h.url('pullrequest_home',repo_name=c.repo_name)}";
 

	
 
                var checkbox_checker = function(e){
 
                    var checked_checkboxes = [];
 
@@ -188,14 +187,17 @@ ${self.context_bar('changelog')}
 
                        YUD.setStyle('rev_range_container','display','');
 
                        YUD.setStyle('rev_range_clear','display','');
 

	
 
                        YUD.get('open_new_pr').href = pr_tmpl + '?rev_start={0}&rev_end={1}'.format(rev_start,rev_end);
 
                        var pr_tmpl = "${h.url('pullrequest_home',repo_name=c.repo_name,rev_start='{0}',rev_end='{1}')}";
 
                        YUD.get('open_new_pr').href = pr_tmpl.format(rev_start,rev_end);
 
                        YUD.setStyle('compare_fork','display','none');
 
                    }else{
 
                        YUD.setStyle('rev_range_container','display','none');
 
                        YUD.setStyle('rev_range_clear','display','none');
 
                        if (checkboxes){
 
                            YUD.get('open_new_pr').href = pr_tmpl + '?rev_end={0}'.format(checkboxes[0].name);
 
                        }
 
                        %if c.branch_name:
 
                            YUD.get('open_new_pr').href = "${h.url('pullrequest_home',repo_name=c.repo_name,branch=c.branch_name)}";
 
                        %else:
 
                            YUD.get('open_new_pr').href = "${h.url('pullrequest_home',repo_name=c.repo_name)}";
 
                        %endif
 
                        YUD.setStyle('compare_fork','display','');
 
                    }
 
                };
0 comments (0 inline, 0 general)