changeset 7326:abaf8e1033a6

pullrequests: don't show empty "additional changesets" (issue #280) When opening a pullrequest on a revision range including the tipmost revision, and then pushing a new revision on top of that, the PR page shows: This pullrequest can be updated with changes on ...: and then nothing. This is because the available revisions looped over are in 'avail_cs' but the guard around the loop is checking on 'avail_revs'. The former, while derived from avail_revs, can become empty under circumstances like this one. Fix the problem by changing the guard checking avail_cs rather than avail_revs, and making sure the printed message is aligned to 'No additional changes found'.
author Thomas De Schampheleire <thomas.de_schampheleire@nokia.com>
date Sat, 19 May 2018 22:00:41 +0200
parents a560e17d88a1
children 9937ae52f167
files kallithea/controllers/pullrequests.py kallithea/templates/pullrequests/pullrequest_show.html
diffstat 2 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/controllers/pullrequests.py	Mon Jun 04 14:28:19 2018 +0200
+++ b/kallithea/controllers/pullrequests.py	Sat May 19 22:00:41 2018 +0200
@@ -541,7 +541,10 @@
                             hgrepo = org_scm_instance._repo
                         show = set(hgrepo.revs('::%ld & !::parents(%s) & !::%s',
                                                avail_revs, revs[0], targethead))
-                        c.update_msg = _('The following additional changes are available on %s:') % c.cs_branch_name
+                        if show:
+                            c.update_msg = _('The following additional changes are available on %s:') % c.cs_branch_name
+                        else:
+                            c.update_msg = _('No additional changesets found for iterating on this pull request.')
                     else:
                         show = set()
                         avail_revs = set() # drop revs[0]
--- a/kallithea/templates/pullrequests/pullrequest_show.html	Mon Jun 04 14:28:19 2018 +0200
+++ b/kallithea/templates/pullrequests/pullrequest_show.html	Sat May 19 22:00:41 2018 +0200
@@ -136,7 +136,7 @@
           <label>${_('Next iteration')}:</label>
             <div>
               <p>${c.update_msg}</p>
-              %if c.avail_revs:
+              %if c.avail_cs:
               <div id="updaterevs" class="clearfix">
                 <div id="updaterevs-graph">
                   <canvas id="avail_graph_canvas"></canvas>