From c53f8213bc52439786cbd0fbc3194e65b875f548 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Cumplido?= Date: Mon, 20 May 2024 17:17:38 -0400 Subject: [PATCH] GH-41735: [CI][Archery] Update archery to be compatible with pygit2 1.15 API change (#41739) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### Rationale for this change pygit2 updated how they expose some of the `GIT_OBJ` variables to use `GIT_OBJECT` prefix here: https://github.com/libgit2/pygit2/commit/8b3861b9092d1e3517b11f6ab06434ea866dd051 ### What changes are included in this PR? Update code to make it compatible with both possible APIs. ### Are these changes tested? Via archery ### Are there any user-facing changes? No * GitHub Issue: #41735 Authored-by: Raúl Cumplido Signed-off-by: Sutou Kouhei --- dev/archery/archery/crossbow/core.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/dev/archery/archery/crossbow/core.py b/dev/archery/archery/crossbow/core.py index f3a52a1b7588e..6213cc907300b 100644 --- a/dev/archery/archery/crossbow/core.py +++ b/dev/archery/archery/crossbow/core.py @@ -427,8 +427,14 @@ def create_branch(self, branch_name, files, parents=None, message='', return branch def create_tag(self, tag_name, commit_id, message=''): + git_object_commit = ( + pygit2.GIT_OBJECT_COMMIT + if getattr(pygit2, 'GIT_OBJECT_COMMIT') + else pygit2.GIT_OBJ_COMMIT + ) tag_id = self.repo.create_tag(tag_name, commit_id, - pygit2.GIT_OBJ_COMMIT, self.signature, + git_object_commit, + self.signature, message) # append to the pushable references