Changeset - c1df0ddc9c58
[Not reviewed]
stable
0 1 0
Mathias De Mare - 3 years ago 2023-01-04 13:22:57
mathias.de_mare@nokia.com
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.
1 file changed with 8 insertions and 0 deletions:
0 comments (0 inline, 0 general)
kallithea/controllers/pullrequests.py
Show inline comments
 
@@ -35,6 +35,7 @@ from tg import tmpl_context as c
 
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 @@ class PullrequestsController(base.BaseRe
 
        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 @@ class PullrequestsController(base.BaseRe
 
        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)
0 comments (0 inline, 0 general)