Mercurial > kallithea
changeset 8979:c1df0ddc9c58 stable
pullrequests: introduce limit to stop displaying additional changes
We've noticed some scalability issues when many descendants exist for the
changesets in a pull request.
To resolve this issue, we instead do not display any additional changes at all
if the amount of additional changes is larger than a configured limit.
(This occurred because we were merging a lot of heads in the repository.)
Throwing away some of the changesets would also keep the total amount more
manageable, but this would result in an (for the user) unpredictable subset of
changesets being shown.
This could be extended further with "too long to be shown - click here to
show", but that was quite a bit of additional work and did not cover our use
case of not allowing the display at all in case of too many additional changes.
author | Mathias De Mare <mathias.de_mare@nokia.com> |
---|---|
date | Wed, 04 Jan 2023 13:22:57 +0100 |
parents | 3c55f6f179fb |
children | 86b9eed9d105 |
files | kallithea/controllers/pullrequests.py |
diffstat | 1 files changed, 8 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/kallithea/controllers/pullrequests.py Tue Dec 27 20:22:14 2022 +0100 +++ b/kallithea/controllers/pullrequests.py Wed Jan 04 13:22:57 2023 +0100 @@ -35,6 +35,7 @@ from tg.i18n import ugettext as _ from webob.exc import HTTPBadRequest, HTTPForbidden, HTTPFound, HTTPNotFound +import kallithea import kallithea.lib.helpers as h from kallithea.controllers import base from kallithea.controllers.changeset import create_cs_pr_comment, delete_cs_pr_comment @@ -494,6 +495,8 @@ except IndexError: # probably because c.cs_ranges is empty, probably because revisions are missing pass + rev_limit = safe_int(kallithea.CONFIG.get('next_iteration_rev_limit'), 0) + avail_revs = set() avail_show = [] c.cs_branch_name = c.cs_ref_name @@ -563,6 +566,11 @@ except ChangesetDoesNotExistError: c.update_msg = _('Error: some changesets not found when displaying pull request from %s.') % c.cs_rev + if rev_limit: + if len(avail_revs) - 1 > rev_limit: + c.update_msg = _('%d additional changesets are not shown.') % (len(avail_revs) - 1) + avail_show = [] + c.avail_revs = avail_revs c.avail_cs = [org_scm_instance.get_changeset(r) for r in avail_show] c.avail_jsdata = graph_data(org_scm_instance, avail_show)