# HG changeset patch # User Mads Kiilerich # Date 1404475926 -7200 # Node ID 494eab6ec837f1c4adeb441cd4e88e5a788b2863 # Parent 65a964fc9053a6cc196be93179267a0594ef6629 pull requests: shorten revision numbers in automatic titles - but it would perhaps be better to use branch names ... diff -r 65a964fc9053 -r 494eab6ec837 kallithea/controllers/pullrequests.py --- a/kallithea/controllers/pullrequests.py Tue Dec 10 19:30:37 2013 +0100 +++ b/kallithea/controllers/pullrequests.py Fri Jul 04 14:12:06 2014 +0200 @@ -366,7 +366,7 @@ org_repo_name = _form['org_repo'] org_ref = _form['org_ref'] # will have merge_rev as rev but symbolic name org_repo = RepoModel()._get_repo(org_repo_name) - (_org_ref_type, + (org_ref_type, org_ref_name, org_rev) = org_ref.split(':') @@ -392,7 +392,8 @@ title = _form['pullrequest_title'] if not title: - title = '%s#%s to %s#%s' % (org_repo_name, org_ref_name, other_repo_name, other_ref_name) + 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)) description = _form['pullrequest_desc'].strip() or _('No description') try: pull_request = PullRequestModel().create( diff -r 65a964fc9053 -r 494eab6ec837 kallithea/lib/helpers.py --- a/kallithea/lib/helpers.py Tue Dec 10 19:30:37 2013 +0100 +++ b/kallithea/lib/helpers.py Fri Jul 04 14:12:06 2014 +0200 @@ -1379,6 +1379,11 @@ return literal('
%s
' % MarkupRenderer.rst_with_mentions(source)) +def short_ref(ref_type, ref_name): + if ref_type == 'rev': + return short_id(ref_name) + return ref_name + def link_to_ref(repo_name, ref_type, ref_name, rev=None): """ Return full markup for a href to changeset_home for a changeset. @@ -1386,10 +1391,7 @@ ref_name is shortened if ref_type is 'rev'. if rev is specified show it too, explicitly linking to that revision. """ - if ref_type == 'rev': - txt = short_id(ref_name) - else: - txt = ref_name + txt = short_ref(ref_type, ref_name) if ref_type == 'branch': u = url('changelog_home', repo_name=repo_name, branch=ref_name) else: