Changeset - e30401bac6e1
[Not reviewed]
default
0 9 0
Mads Kiilerich - 11 years ago 2014-08-12 13:08:23
madski@unity3d.com
pull requests: show more helpful URLs
9 files changed with 27 insertions and 15 deletions:
0 comments (0 inline, 0 general)
kallithea/config/routing.py
Show inline comments
 
@@ -699,7 +699,7 @@ def make_map(config):
 
                                                       method=["POST"]))
 

	
 
    rmap.connect('pullrequest_show',
 
                 '/{repo_name:.*?}/pull-request/{pull_request_id}',
 
                 '/{repo_name:.*?}/pull-request/{pull_request_id:\\d+}{extra:(/.*)?}', extra='',
 
                 controller='pullrequests',
 
                 action='show', conditions=dict(function=check_repo,
 
                                                method=["GET"]))
kallithea/controllers/pullrequests.py
Show inline comments
 
@@ -460,8 +460,7 @@ class PullrequestsController(BaseRepoCon
 
            log.error(traceback.format_exc())
 
            return redirect(url('pullrequest_home', repo_name=repo_name))
 

	
 
        return redirect(url('pullrequest_show', repo_name=other_repo_name,
 
                            pull_request_id=pull_request.pull_request_id))
 
        return redirect(pull_request.url())
 

	
 
    @LoginRequired()
 
    @NotAnonymous()
 
@@ -639,7 +638,7 @@ class PullrequestsController(BaseRepoCon
 
    @LoginRequired()
 
    @HasRepoPermissionAnyDecorator('repository.read', 'repository.write',
 
                                   'repository.admin')
 
    def show(self, repo_name, pull_request_id):
 
    def show(self, repo_name, pull_request_id, extra=None):
 
        repo_model = RepoModel()
 
        c.users_array = repo_model.get_users_js()
 
        c.user_groups_array = repo_model.get_user_groups_js()
kallithea/lib/utils2.py
Show inline comments
 
@@ -756,3 +756,6 @@ class Optional(object):
 
        if isinstance(val, cls):
 
            return val.getval()
 
        return val
 

	
 
def urlreadable(s, _cleanstringsub=re.compile('[^-a-zA-Z0-9./]+').sub):
 
    return _cleanstringsub('_', safe_str(s)).rstrip('_')
kallithea/model/comment.py
Show inline comments
 
@@ -127,9 +127,7 @@ class ChangesetCommentsModel(BaseModel):
 
                threading.append('%s-pr-%s-line-%s@%s' % (pull_request.other_repo.repo_name,
 
                                                          pull_request.pull_request_id, line_no,
 
                                                          h.canonical_hostname()))
 
            comment_url = h.canonical_url('pullrequest_show',
 
                repo_name=pull_request.other_repo.repo_name,
 
                pull_request_id=pull_request.pull_request_id,
 
            comment_url = pull_request.url(canonical=True,
 
                anchor='comment-%s' % comment.comment_id)
 
            subj = safe_unicode(
 
                h.link_to('Re pull request #%(pr_id)s: %(desc)s %(line)s' % \
kallithea/model/db.py
Show inline comments
 
@@ -51,7 +51,7 @@ from kallithea.lib.vcs.backends.base imp
 

	
 
from kallithea.lib.utils2 import str2bool, safe_str, get_changeset_safe, \
 
    safe_unicode, remove_prefix, time_to_datetime, aslist, Optional, safe_int, \
 
    get_clone_url
 
    get_clone_url, urlreadable
 
from kallithea.lib.compat import json
 
from kallithea.lib.caching_query import FromCache
 

	
 
@@ -2306,6 +2306,19 @@ class PullRequest(Base, BaseModel):
 
            revisions=self.revisions
 
        )
 

	
 
    def url(self, **kwargs):
 
        canonical = kwargs.pop('canonical', None)
 
        import kallithea.lib.helpers as h
 
        s = '/' + self.title
 
        b = self.org_ref_parts[1]
 
        if b not in s and b != self.other_ref_parts[1]:
 
            s = '/_%s_%s' % (b, s)
 
        kwargs['extra'] = urlreadable(s)
 
        if canonical:
 
            return h.canonical_url('pullrequest_show', repo_name=self.other_repo.repo_name,
 
                                   pull_request_id=self.pull_request_id, **kwargs)
 
        return h.url('pullrequest_show', repo_name=self.other_repo.repo_name,
 
                     pull_request_id=self.pull_request_id, **kwargs)
 

	
 
class PullRequestReviewers(Base, BaseModel):
 
    __tablename__ = 'pull_request_reviewers'
kallithea/model/pull_request.py
Show inline comments
 
@@ -124,8 +124,7 @@ class PullRequestModel(BaseModel):
 
                         for x in map(pr.org_repo.get_changeset, pr.revisions)]
 

	
 
        #notification to reviewers
 
        pr_url = h.canonical_url('pullrequest_show', repo_name=pr.other_repo.repo_name,
 
                       pull_request_id=pr.pull_request_id)
 
        pr_url = pr.url(canonical=True)
 
        threading = [h.canonical_url('pullrequest_show', repo_name=pr.other_repo.repo_name,
 
                                     pull_request_id=pr.pull_request_id)]
 
        subject = safe_unicode(
kallithea/templates/changeset/changeset_file_comment.html
Show inline comments
 
@@ -20,10 +20,10 @@
 
         %if co.pull_request:
 
            %if co.status_change:
 
              ${_('Status change from pull request')}
 
              <a href="${h.url('pullrequest_show',repo_name=co.pull_request.other_repo.repo_name,pull_request_id=co.pull_request.pull_request_id)}">"${co.pull_request.title or _("No title")}"</a>:
 
              <a href="${co.pull_request.url()}">"${co.pull_request.title or _("No title")}"</a>:
 
            %else:
 
              ${_('Comment from pull request')}
 
              <a href="${h.url('pullrequest_show',repo_name=co.pull_request.other_repo.repo_name,pull_request_id=co.pull_request.pull_request_id)}">"${co.pull_request.title or _("No title")}"</a>
 
              <a href="${co.pull_request.url()}">"${co.pull_request.title or _("No title")}"</a>
 
            %endif
 
         %else:
 
            %if co.status_change:
kallithea/templates/pullrequests/pullrequest_data.html
Show inline comments
 
@@ -8,7 +8,7 @@
 
    %else:
 
      <img src="${h.url('/images/icons/flag_status_not_reviewed.png')}" title="${_("Nobody voted")}"/>
 
    %endif
 
      <a href="${h.url('pullrequest_show',repo_name=pr.other_repo.repo_name,pull_request_id=pr.pull_request_id)}">
 
      <a href="${pr.url()}">
 
      ${pr.title or _("(no title)")}
 
       %if pr.is_closed():
 
         <span class="pr-closed-tag">${_('Closed')}</span>
kallithea/templates/pullrequests/pullrequest_show_my_data.html
Show inline comments
 
@@ -10,7 +10,7 @@ ${h.checkbox('show_closed',checked="chec
 
            %else:
 
              <img src="${h.url('/images/icons/flag_status_not_reviewed.png')}" title="${_("Nobody voted")}"/>
 
            %endif
 
            <a href="${h.url('pullrequest_show',repo_name=pull_request.other_repo.repo_name,pull_request_id=pull_request.pull_request_id)}">
 
            <a href="${pull_request.url()}">
 
              ${pull_request.title or _("(no title)")}
 
            </a>
 
            ${_('opened on %s from') % (h.fmt_date(pull_request.created_on))}
 
@@ -43,7 +43,7 @@ ${h.checkbox('show_closed',checked="chec
 
            %else:
 
              <img src="${h.url('/images/icons/flag_status_not_reviewed.png')}" title="${_("Nobody voted")}"/>
 
            %endif
 
            <a href="${h.url('pullrequest_show',repo_name=pull_request.other_repo.repo_name,pull_request_id=pull_request.pull_request_id)}">
 
            <a href="${pull_request.url()}">
 
              ${pull_request.title or _("(no title)")}
 
            </a>
 
            ${_('from')}
0 comments (0 inline, 0 general)