changeset 8920:a8b407f29405 stable

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
author Manuel Jacob <me@manueljacob.de>
date Fri, 25 Feb 2022 22:00:46 +0100
parents c63a982b2e6c
children 586ce8c23529
files kallithea/controllers/changelog.py
diffstat 1 files changed, 1 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/kallithea/controllers/changelog.py	Tue Feb 08 01:06:04 2022 +0100
+++ b/kallithea/controllers/changelog.py	Fri Feb 25 22:00:46 2022 +0100
@@ -114,7 +114,7 @@
                         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)