# HG changeset patch # User Thomas De Schampheleire # Date 2018-05-19 22:00:41 # Node ID abaf8e1033a6471172c953df2ee4555f2f3c7a40 # Parent a560e17d88a16709102a7e34ed7b5876a117316a 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'. diff --git a/kallithea/controllers/pullrequests.py b/kallithea/controllers/pullrequests.py --- a/kallithea/controllers/pullrequests.py +++ b/kallithea/controllers/pullrequests.py @@ -541,7 +541,10 @@ class PullrequestsController(BaseRepoCon 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] 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 @@ -136,7 +136,7 @@ ${self.repo_context_bar('showpullrequest

${c.update_msg}

- %if c.avail_revs: + %if c.avail_cs: