# HG changeset patch # User Mads Kiilerich # Date 2015-01-21 17:35:11 # Node ID b486cf5da28d82eb9b5da201b26cf5b3ccbfebdd # Parent fee908b9bd2d4096df76e307abbedde463c39ff7 pullrequests: reverse the 'available' list - most recent first Avoid reversing in the templates. cs_revs should be reversed too. That is for another day. diff --git a/kallithea/controllers/pullrequests.py b/kallithea/controllers/pullrequests.py --- a/kallithea/controllers/pullrequests.py +++ b/kallithea/controllers/pullrequests.py @@ -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) diff --git a/kallithea/templates/pullrequests/pullrequest_show.html b/kallithea/templates/pullrequests/pullrequest_show.html --- a/kallithea/templates/pullrequests/pullrequest_show.html +++ b/kallithea/templates/pullrequests/pullrequest_show.html @@ -183,7 +183,7 @@ ${self.repo_context_bar('showpullrequest %if c.available:
- %for cnt, cs in enumerate(reversed(c.available)): + %for cnt, cs in enumerate(c.available):
${h.radio(name='updaterev', value=cs.raw_id)} ${h.link_to(h.show_id(cs),h.url('changeset_home',repo_name=c.cs_repo.repo_name,revision=cs.raw_id))}