# HG changeset patch # User Søren Løvborg # Date 1483711039 -3600 # Node ID 63460acc2569828c6efd4596236bb045f3375ef1 # Parent 175813f77851043c2af72ff850b98fc9553cf779 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. diff -r 175813f77851 -r 63460acc2569 kallithea/controllers/pullrequests.py --- a/kallithea/controllers/pullrequests.py Sat Jan 14 20:59:57 2017 +0100 +++ b/kallithea/controllers/pullrequests.py Fri Jan 06 14:57:19 2017 +0100 @@ -327,6 +327,7 @@ (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 @@ 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 @@ 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)