[PATCH 1 of 2] api: fix get_changeset() when incomplete raw_id is passed with with_reviews

Manuel Jacob me at manueljacob.de
Wed Mar 29 10:06:07 UTC 2023


# HG changeset patch
# User Manuel Jacob <me at manueljacob.de>
# Date 1680080700 -7200
#      Wed Mar 29 11:05:00 2023 +0200
# Node ID 2704d3ca4210e14e559b2a1f23dacdd988989533
# Parent  7037365a7bc351b81f05c790c6d3417d81d7bd5d
# EXP-Topic api-comments
api: fix get_changeset() when incomplete raw_id is passed with with_reviews

Previously, ChangesetStatusModel was queried with the raw_id passed as an argument to the API function. When the raw_id was incomplete (i.e. shortened), no reviews were found. Using the full raw_id from the changeset instance fixes that.

Someone might argue that the caller is supposed to pass a full raw_id to the API function. However, in any case, the return value should not be incomplete without notice.

diff --git a/kallithea/controllers/api/api.py b/kallithea/controllers/api/api.py
--- a/kallithea/controllers/api/api.py
+++ b/kallithea/controllers/api/api.py
@@ -2335,7 +2335,7 @@
 
         if with_reviews:
             reviews = ChangesetStatusModel().get_statuses(
-                                repo.repo_name, raw_id)
+                                repo.repo_name, changeset.raw_id)
             info["reviews"] = reviews
 
         return info



More information about the kallithea-general mailing list