Re: [PATCH stable] controllers: don’t pass start=0 to BaseRepository.get_changesets()

Mads Kiilerich mads at kiilerich.com
Mon Mar 7 17:07:26 UTC 2022


Pushed to stable - thanks.

/Mads


On 2/25/22 22:08, Manuel Jacob wrote:
> # HG changeset patch
> # User Manuel Jacob <me at manueljacob.de>
> # Date 1645822846 -3600
> #      Fri Feb 25 22:00:46 2022 +0100
> # Branch stable
> # Node ID 397f73d1cdd4b39c9c17bb8d45592e866fcab88c
> # Parent  017595560fc1e0f2acc086c63ed5f8906011d77b
> 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 @@
>                           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)
>   
> _______________________________________________
> kallithea-general mailing list
> kallithea-general at sfconservancy.org
> https://lists.sfconservancy.org/mailman/listinfo/kallithea-general




More information about the kallithea-general mailing list