Changeset - b486cf5da28d
[Not reviewed]
default
0 2 0
Mads Kiilerich - 11 years ago 2015-01-21 17:35:11
madski@unity3d.com
pullrequests: reverse the 'available' list - most recent first

Avoid reversing in the templates.

cs_revs should be reversed too. That is for another day.
2 files changed with 5 insertions and 4 deletions:
0 comments (0 inline, 0 general)
kallithea/controllers/pullrequests.py
Show inline comments
 
@@ -570,7 +570,7 @@ class PullrequestsController(BaseRepoCon
 
        revs = [ctx.revision for ctx in reversed(c.cs_ranges)]
 
        c.jsdata = json.dumps(graph_data(org_scm_instance, revs))
 

	
 
        c.available = []
 
        arevs = []
 
        c.cs_branch_name = c.cs_ref_name
 
        other_scm_instance = c.a_repo.scm_instance
 
        c.update_msg = ""
 
@@ -584,7 +584,6 @@ class PullrequestsController(BaseRepoCon
 
                    c.a_branch_name = other_scm_instance.get_changeset(c.a_ref_name).branch # use ref_type ?
 
                except EmptyRepositoryError:
 
                    c.a_branch_name = 'null' # not a branch name ... but close enough
 
            arevs = []
 
            # candidates: descendants of old head that are on the right branch
 
            #             and not are the old head itself ...
 
            #             and nothing at all if old head is a descendent of target ref name
 
@@ -594,11 +593,11 @@ class PullrequestsController(BaseRepoCon
 
                arevs = org_scm_instance._repo.revs('%s:: & branch(%s) - %s',
 
                                                    revs[0], c.cs_branch_name, revs[0])
 
                if arevs:
 
                    arevs = sorted(arevs, reverse=True)
 
                    if c.pull_request.is_closed():
 
                        c.update_msg = _('This pull request has been closed and can not be updated with descendent changes on %s:') % c.cs_branch_name
 
                    else:
 
                        c.update_msg = _('This pull request can be updated with descendent changes on %s:') % c.cs_branch_name
 
                    c.available = [org_scm_instance.get_changeset(x) for x in arevs]
 
                else:
 
                    c.update_msg = _('No changesets found for updating this pull request.')
 

	
 
@@ -610,6 +609,8 @@ class PullrequestsController(BaseRepoCon
 
        elif org_scm_instance.alias == 'git':
 
            c.update_msg = _("Git pull requests don't support updates yet.")
 

	
 
        c.available = [org_scm_instance.get_changeset(r) for r in arevs]
 

	
 
        raw_ids = [x.raw_id for x in c.cs_ranges]
 
        c.cs_comments = c.cs_repo.get_comments(raw_ids)
 
        c.statuses = c.cs_repo.statuses(raw_ids)
kallithea/templates/pullrequests/pullrequest_show.html
Show inline comments
 
@@ -183,7 +183,7 @@ ${self.repo_context_bar('showpullrequest
 
              %if c.available:
 
              <div style="max-height:200px; overflow-y:auto; overflow-x:hidden; margin-bottom: 10px">
 
                <table class="noborder">
 
                  %for cnt, cs in enumerate(reversed(c.available)):
 
                  %for cnt, cs in enumerate(c.available):
 
                    <tr>
 
                    <td>${h.radio(name='updaterev', value=cs.raw_id)}</td>
 
                    <td>${h.link_to(h.show_id(cs),h.url('changeset_home',repo_name=c.cs_repo.repo_name,revision=cs.raw_id))}</td>
0 comments (0 inline, 0 general)