Skip to content

Commit

Permalink
Fix pygit2 deprecations (#127)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
No767 and pre-commit-ci[bot] authored May 29, 2024
1 parent d8bca17 commit adad8ee
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
default_language_version:
python: python3.11
python: python3.12
files: '.py'
exclude: ".env,.yml,.gitignore,.git,.md,.txt"
default_stages: [push, commit]
Expand Down
5 changes: 3 additions & 2 deletions bot/cogs/utilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def get_bot_uptime(self, *, brief: bool = False) -> str:

def format_commit(self, commit: pygit2.Commit) -> str:
short, _, _ = commit.message.partition("\n")
short_sha2 = commit.hex[0:6]
short_sha2 = str(commit.id)[0:6]
commit_tz = datetime.timezone(
datetime.timedelta(minutes=commit.commit_time_offset)
)
Expand All @@ -42,7 +42,8 @@ def format_commit(self, commit: pygit2.Commit) -> str:

# [`hash`](url) message (offset)
offset = format_dt(commit_time.astimezone(datetime.timezone.utc), "R")
return f"[`{short_sha2}`](https://github.com/transprogrammer/rodhaj/commit/{commit.hex}) {short} ({offset})"
commit_id = str(commit.id)
return f"[`{short_sha2}`](https://github.com/transprogrammer/rodhaj/commit/{commit_id}) {short} ({offset})"

def get_last_commits(self, count: int = 5):
repo = pygit2.Repository(".git")
Expand Down

0 comments on commit adad8ee

Please sign in to comment.