Skip to content

Commit ac094dc

Browse files
committed
fix: remove deprecated pygit2 method usage
Signed-off-by: David van der Spek <david.vanderspek@flyrlabs.com>
1 parent 53a74ae commit ac094dc

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

packages/opal-server/opal_server/git_fetcher.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ def create_local_branch_ref(
6464
else:
6565
raise RuntimeError("Base branch was not found on remote")
6666
logger.debug(
67-
f"Created local branch '{branch_name}', pointing to: {commit.hex}"
67+
f"Created local branch '{branch_name}', pointing to: {str(commit.id)}"
6868
)
69-
return repo.create_reference(f"refs/heads/{branch_name}", commit.hex)
69+
return repo.create_reference(f"refs/heads/{branch_name}", str(commit.id))
7070
else:
7171
logger.debug(
7272
f"No need to create local branch '{branch_name}': already exists!"
@@ -92,7 +92,7 @@ def get_local_branch(repo: Repository, branch: str) -> Optional[pygit2.Reference
9292
def get_commit_hash(repo: Repository, branch: str, remote: str) -> Optional[str]:
9393
try:
9494
(commit, _) = repo.resolve_refish(f"{remote}/{branch}")
95-
return commit.hex
95+
return str(commit.id)
9696
except (pygit2.GitError, KeyError):
9797
return None
9898

@@ -104,7 +104,7 @@ def get_tag_commit_hash(repo: Repository, tag_name: str) -> Optional[str]:
104104
# If the tag is annotated, dereference to the commit
105105
if commit.type == pygit2.GIT_OBJECT_TAG:
106106
commit = commit.peel(pygit2.Commit)
107-
return commit.hex
107+
return str(commit.id)
108108
except (KeyError, pygit2.GitError):
109109
return None
110110

@@ -373,7 +373,7 @@ async def _notify_on_changes(self, repo: Repository):
373373
repo, self.local_branch_name, self._remote, self._source.branch
374374
)
375375
else:
376-
old_revision = local_branch.target.hex
376+
old_revision = str(local_branch.target)
377377

378378
await self.callbacks.on_update(old_revision, new_revision)
379379

0 commit comments

Comments
 (0)