# HG changeset patch # User Manuel Jacob # Date 2022-02-25 21:00:46 # Node ID a8b407f2940595ce450f757290595815dfcb958f # Parent c63a982b2e6ca032a32fe003b70969ec7137af80 controllers: don’t pass start=0 to BaseRepository.get_changesets() MercurialRepository.get_changesets() can fail if passing start=0 if the revision 0 is not in self.revisions. That can happen if revision 0 is not in the visible subset of the revisions in the repository. Before Kallithea changeset 7c43e15fb8bc7a73f17f577e59a4698589b6809d, it was working by chance because start=0 was treated like start=None in the relevant places (GitRepository.get_changesets still does that). The intention of passing start=0 was seemingly to not limit the start. Therefore passing start=None (or nothing, as it’s the default value) should be correct. I got the following traceback before this change: Traceback (most recent call last): File "~/vcs/kallithea/kallithea/controllers/changelog.py", line 117, in index collection = c.db_repo_scm_instance.get_changesets(start=0, end=revision, File "~/vcs/kallithea/kallithea/lib/vcs/backends/hg/repository.py", line 529, in get_changesets start_pos = None if start is None else self.revisions.index(start_raw_id) ValueError: '4257f758b3eaacaebb6956d1aefc019afab956b8' is not in list diff --git a/kallithea/controllers/changelog.py b/kallithea/controllers/changelog.py --- a/kallithea/controllers/changelog.py +++ b/kallithea/controllers/changelog.py @@ -114,7 +114,7 @@ class ChangelogController(base.BaseRepoC webutils.flash(e, category='warning') raise HTTPFound(location=webutils.url('changelog_home', repo_name=repo_name)) else: - collection = c.db_repo_scm_instance.get_changesets(start=0, end=revision, + collection = c.db_repo_scm_instance.get_changesets(end=revision, branch_name=branch_name, reverse=True) c.total_cs = len(collection)