Changeset - 63460acc2569
[Not reviewed]
default
0 1 0
Søren Løvborg - 9 years ago 2017-01-06 14:57:19
sorenl@unity3d.com
pullrequests: refactor default title code

This refactoring simply emphasizes that the origin reference used to
generate the default title is not always the same as the one actually
used to create the pull request; for PRs not from a branch head, the
branch name is stored so it can be used for creating new iterations.
1 file changed with 5 insertions and 4 deletions:
0 comments (0 inline, 0 general)
kallithea/controllers/pullrequests.py
Show inline comments
 
@@ -327,6 +327,7 @@ class PullrequestsController(BaseRepoCon
 
        (org_ref_type,
 
         org_ref_name,
 
         org_rev) = org_ref.split(':')
 
        org_display = h.short_ref(org_ref_type, org_ref_name)
 
        if org_ref_type == 'rev':
 
            cs = org_repo.scm_instance.get_changeset(org_rev)
 
            org_ref = 'branch:%s:%s' % (cs.branch, cs.raw_id)
 
@@ -341,6 +342,7 @@ class PullrequestsController(BaseRepoCon
 
            cs = other_repo.scm_instance.get_changeset(other_rev)
 
            other_ref_name = cs.raw_id[:12]
 
            other_ref = '%s:%s:%s' % (other_ref_type, other_ref_name, cs.raw_id)
 
        other_display = h.short_ref(other_ref_type, other_ref_name)
 

	
 
        cs_ranges, _cs_ranges_not, ancestor_revs = \
 
            CompareController._get_changesets(org_repo.scm_instance.alias,
 
@@ -373,11 +375,10 @@ class PullrequestsController(BaseRepoCon
 
        title = _form['pullrequest_title']
 
        if not title:
 
            if org_repo_name == other_repo_name:
 
                title = '%s to %s' % (h.short_ref(org_ref_type, org_ref_name),
 
                                      h.short_ref(other_ref_type, other_ref_name))
 
                title = '%s to %s' % (org_display, other_display)
 
            else:
 
                title = '%s#%s to %s#%s' % (org_repo_name, h.short_ref(org_ref_type, org_ref_name),
 
                                            other_repo_name, h.short_ref(other_ref_type, other_ref_name))
 
                title = '%s#%s to %s#%s' % (org_repo_name, org_display,
 
                                            other_repo_name, other_display)
 
        description = _form['pullrequest_desc'].strip() or _('No description')
 
        try:
 
            created_by = User.get(request.authuser.user_id)
0 comments (0 inline, 0 general)