Description: Stop using pygit 2 .oid and .hex

(they no longer exist)

This generates approximately this patch (but isn't exactly what was used as some bugs were fixed afterwards) but needs some manual fixup

shopt -s globstar
dpkg-source --before-build .
# the first one is where we can easily tell where the str( goes - note that ([ not ]) in (1) is intentional, (3) matches either nothing or one of [0], [-1], ()
# the __str__() form is used where we can't easily tell where the str( goes, and may be manually fixed up afterwards, or in jinja templates (where the builtins aren't available but method calls are)
# ($|[^a-z]) is to avoid matching longer names that start with .oid or .hex
# peel() is an object, .target and .tree_id are oids
# assume the rest are objects (this way round as calling .id on already-an-oid will *immediately* fail) and see what complains
for f0 in pagure/templates/**/*.html ; do sed -i -E  -e 's/\.(oid|target|tree_id)\.hex($|[^a-z])/.\1.__str__()\2/g' -e 's/\.oid($|[^a-z])/.id\1/g' -e 's/\.hex($|[^a-z])/.id.__str__()\1/g' ${f0} ; done
for f0 in pagure/**/*.py tests/**/*.py dev-data.py ; do sed -i -E -e 's/([ =\[\(\{])([0-9a-zA-Z_.]+?)(\[0\]|\[-1\]|\(\)|)\.(oid|target|tree_id)\.hex/\1str(\2\3.\4)/g' -e 's/\.(oid|target|tree_id)\.hex($|[^a-z])/.\1.__str__()\2/g' -e 's/\.oid($|[^a-z])/.id\1/g' -e 's/([ =\[\(\{])([0-9a-zA-Z_.]+?)(\[0\]|\[-1\]|\(\)|)\.hex($|[^a-z])/\1str(\2\3.id)\4/g' -e 's/\.hex($|[^a-z])/.id.__str__()\1/g' ${f0} ; done
# this file uses uuid hex, undo whatever we did to that
# other places that do were fixed manually
git diff pagure/lib/query.py | patch -p1 -R
grep -rniE -e "\.oid|\.hex" --exclude-dir=.pc --exclude-dir=debian .
dpkg-source --commit . 0020-pygit2-hex-oid-removed.patch

Author: Rebecca N. Palmer <rebecca_palmer@zoho.com>
Forwarded: https://pagure.io/pagure/pull-request/5514

--- a/dev-data.py
+++ b/dev-data.py
@@ -570,7 +570,7 @@ def add_content_git_repo(folder, branch=
     except KeyError:
         pass
     if commit:
-        parents = [commit.oid.hex]
+        parents = [str(commit.id)]
 
     # Commits the files added
     tree = repo.index.write_tree()
@@ -594,7 +594,7 @@ def add_content_git_repo(folder, branch=
     except KeyError:
         pass
     if commit:
-        parents = [commit.oid.hex]
+        parents = [str(commit.id)]
 
     subfolder = os.path.join("folder1", "folder2")
     if not os.path.exists(os.path.join(newfolder, subfolder)):
--- a/pagure/api/fork.py
+++ b/pagure/api/fork.py
@@ -1601,14 +1601,14 @@ def api_pull_request_create(repo, userna
                 )
 
     if orig_commit:
-        orig_commit = orig_commit.oid.hex
+        orig_commit = str(orig_commit.id)
 
     initial_comment = form.initial_comment.data.strip() or None
 
     commit_start = commit_stop = None
     if diff_commits:
-        commit_stop = diff_commits[0].oid.hex
-        commit_start = diff_commits[-1].oid.hex
+        commit_stop = str(diff_commits[0].id)
+        commit_start = str(diff_commits[-1].id)
 
     request = pagure.lib.query.new_pull_request(
         flask.g.session,
@@ -1720,7 +1720,7 @@ def api_pull_request_diffstats(repo, req
         try:
             for commit in repo_obj.walk(commitid, pygit2.GIT_SORT_NONE):
                 diff_commits.append(commit)
-                if commit.oid.hex == request.commit_start:
+                if str(commit.id) == request.commit_start:
                     break
         except KeyError:
             # This happens when repo.walk() cannot find commitid
@@ -1729,19 +1729,19 @@ def api_pull_request_diffstats(repo, req
         if diff_commits:
             # Ensure the first commit in the PR as a parent, otherwise
             # point to it
-            start = diff_commits[-1].oid.hex
+            start = str(diff_commits[-1].id)
             if diff_commits[-1].parents:
-                start = diff_commits[-1].parents[0].oid.hex
+                start = str(diff_commits[-1].parents[0].id)
 
             # If the start and the end commits are the same, it means we are,
             # dealing with one commit that has no parent, so just diff that
             # one commit
-            if start == diff_commits[0].oid.hex:
+            if start == str(diff_commits[0].id):
                 diff = diff_commits[0].tree.diff_to_tree(swap=True)
             else:
                 diff = repo_obj.diff(
                     repo_obj.revparse_single(start),
-                    repo_obj.revparse_single(diff_commits[0].oid.hex),
+                    repo_obj.revparse_single(str(diff_commits[0].id)),
                 )
     else:
         try:
--- a/pagure/api/project.py
+++ b/pagure/api/project.py
@@ -922,7 +922,7 @@ def api_view_file(
             raise pagure.exceptions.APIError(
                 404, error_code=APIERROR.EFILENOTFOUND
             )
-        content = repo_obj[content.oid]
+        content = repo_obj[content.id]
     else:
         content = commit
 
@@ -2302,10 +2302,10 @@ def api_commit_info(repo, commit_hash, u
         "committer": commit_obj.committer.name,
         "commit_time": commit_obj.commit_time,
         "commit_time_offset": commit_obj.commit_time_offset,
-        "hash": commit_obj.hex,
+        "hash": str(commit_obj.id),
         "message": commit_obj.message,
-        "parent_ids": [h.hex for h in commit_obj.parent_ids],
-        "tree_id": commit_obj.tree_id.hex,
+        "parent_ids": [str(h) for h in commit_obj.parent_ids],
+        "tree_id": str(commit_obj.tree_id),
     }
 
     return flask.jsonify(info)
--- a/pagure/docs_server.py
+++ b/pagure/docs_server.py
@@ -100,7 +100,7 @@ def __get_tree(repo_obj, tree, filepath,
                     filepath.append("")
                 return __get_tree(
                     repo_obj,
-                    repo_obj[element.oid],
+                    repo_obj[element.id],
                     filepath,
                     index=index + 1,
                     extended=True,
@@ -126,7 +126,7 @@ def __get_tree_and_content(repo_obj, com
     if blob_or_tree is None:
         return (tree_obj, None, None)
 
-    if not repo_obj[blob_or_tree.oid]:
+    if not repo_obj[blob_or_tree.id]:
         # Not tested and no idea how to test it, but better safe than sorry
         flask.abort(404, description="File not found")
 
@@ -139,7 +139,7 @@ def __get_tree_and_content(repo_obj, com
     if is_file:
         filename = blob_or_tree.name
         name, ext = os.path.splitext(filename)
-        blob_obj = repo_obj[blob_or_tree.oid]
+        blob_obj = repo_obj[blob_or_tree.id]
         if not is_binary_string(blob_obj.data):
             try:
                 content, safe = pagure.doc_utils.convert_readme(
--- a/pagure/internal/__init__.py
+++ b/pagure/internal/__init__.py
@@ -612,20 +612,20 @@ def get_branches_of_commit():
 
             if compare_branch:
                 merge_commit_obj = repo_obj.merge_base(
-                    compare_branch.peel().hex, branch.peel().hex
+                    str(compare_branch.peel().id), str(branch.peel().id)
                 )
 
                 if merge_commit_obj:
-                    merge_commit = merge_commit_obj.hex
+                    merge_commit = str(merge_commit_obj)
 
-            repo_commit = repo_obj[branch.peel().hex]
+            repo_commit = repo_obj[str(branch.peel().id)]
 
             for commit in repo_obj.walk(
-                repo_commit.oid.hex, pygit2.GIT_SORT_NONE
+                str(repo_commit.id), pygit2.GIT_SORT_NONE
             ):
-                if commit.oid.hex == merge_commit:
+                if str(commit.id) == merge_commit:
                     break
-                if commit.oid.hex == commit_id:
+                if str(commit.id) == commit_id:
                     branches.append(branchname)
                     break
 
@@ -696,7 +696,7 @@ def get_branches_head():
     if not repo_obj.is_empty and len(repo_obj.listall_branches()) > 1:
         for branchname in repo_obj.listall_branches():
             branch = repo_obj.lookup_branch(branchname)
-            branches[branchname] = branch.peel().hex
+            branches[branchname] = str(branch.peel().id)
 
     # invert the dict
     heads = collections.defaultdict(list)
--- a/pagure/lib/git.py
+++ b/pagure/lib/git.py
@@ -127,7 +127,7 @@ Subject: {subject}
 
 {patch}
 """.format(
-                    commit=commit.oid.hex,
+                    commit=str(commit.id),
                     author_name=commit.author.name,
                     author_email=commit.author.email,
                     date=datetime.datetime.utcfromtimestamp(
@@ -272,7 +272,7 @@ def _update_git(obj, repo):
         # See if there is a parent to this commit
         parent = None
         try:
-            parent = new_repo.head.peel().oid
+            parent = new_repo.head.peel().id
         except pygit2.GitError:
             pass
 
@@ -343,7 +343,7 @@ def _clean_git(repo, obj_repotype, obj_u
         # See if there is a parent to this commit
         parent = None
         if not new_repo.is_empty:
-            parent = new_repo.head.peel().oid
+            parent = new_repo.head.peel().id
 
         parents = []
         if parent:
@@ -942,7 +942,7 @@ def _add_file_to_git(repo, issue, attach
         # See if there is a parent to this commit
         parent = None
         try:
-            parent = new_repo.head.peel().oid
+            parent = new_repo.head.peel().id
         except pygit2.GitError:
             pass
 
@@ -1085,7 +1085,7 @@ class TemporaryClone(object):
                 self.repo.branches.local.create(localname, branch.peel())
             elif ref.startswith("refs/pull/"):
                 reference = self._origrepo.references.get(ref)
-                self.repo.references.create(ref, reference.peel().oid.hex)
+                self.repo.references.create(ref, str(reference.peel().id))
 
         return self
 
@@ -1307,7 +1307,7 @@ def _update_file_in_git(
 
         parents = []
         if parent:
-            parents.append(parent.hex)
+            parents.append(str(parent.id))
 
         # Author/commiter will always be this one
         name = user.fullname or user.username
@@ -1734,8 +1734,8 @@ def merge_pull_request(session, request,
             # Fetch the commits
             remote.fetch()
 
-            # repo_commit = fork_obj[branch.peel().hex]
-            repo_commit = new_repo[branch.peel().hex]
+            # repo_commit = fork_obj[str(branch.peel().id)]
+            repo_commit = new_repo[str(branch.peel().id)]
 
             # Checkout the correct branch
             if new_repo.is_empty or new_repo.head_is_unborn:
@@ -1748,7 +1748,7 @@ def merge_pull_request(session, request,
                     _log.info("  PR merged using fast-forward")
                     if not request.project.settings.get("always_merge", False):
                         new_repo.create_branch(request.branch, repo_commit)
-                        commit = repo_commit.oid.hex
+                        commit = str(repo_commit.id)
                     else:
                         tree = new_repo.index.write_tree()
                         user_obj = pagure.lib.query.get_user(session, username)
@@ -1762,7 +1762,7 @@ def merge_pull_request(session, request,
                             author,
                             "Merge #%s `%s`" % (request.id, request.title),
                             tree,
-                            [repo_commit.oid.hex],
+                            [str(repo_commit.id)],
                         )
 
                     _log.info("  New head: %s", commit)
@@ -1793,14 +1793,14 @@ def merge_pull_request(session, request,
                 ref = new_repo.lookup_reference(
                     "refs/pull/%s/head" % request.id
                 )
-                repo_commit = new_repo[ref.target.hex]
+                repo_commit = new_repo[str(ref.target)]
             except KeyError:
                 pass
 
-        merge = new_repo.merge(repo_commit.oid)
+        merge = new_repo.merge(repo_commit.id)
         _log.debug("  Merge: %s", merge)
         if merge is None:
-            mergecode = new_repo.merge_analysis(repo_commit.oid)[0]
+            mergecode = new_repo.merge_analysis(repo_commit.id)[0]
             _log.debug("  Mergecode: %s", mergecode)
 
         # Wait until the last minute then check if the PR was already closed
@@ -1851,8 +1851,8 @@ def merge_pull_request(session, request,
                         # This is depending on the pygit2 version
                         branch_ref.target = merge.fastforward_oid
                     elif merge is None and mergecode is not None:
-                        branch_ref.set_target(repo_commit.oid.hex)
-                    commit = repo_commit.oid.hex
+                        branch_ref.set_target(str(repo_commit.id))
+                    commit = str(repo_commit.id)
                 else:
                     tree = new_repo.index.write_tree()
                     user_obj = pagure.lib.query.get_user(session, username)
@@ -1879,7 +1879,7 @@ def merge_pull_request(session, request,
                         author,
                         commit_message,
                         tree,
-                        [head.hex, repo_commit.oid.hex],
+                        [str(head.id), str(repo_commit.id)],
                     )
 
                 _log.info("  New head: %s", commit)
@@ -1924,7 +1924,7 @@ def merge_pull_request(session, request,
                 _log.info("  Writing down merge commit")
                 head = new_repo.lookup_reference("HEAD").peel()
                 _log.info(
-                    "  Basing on: %s - %s", head.hex, repo_commit.oid.hex
+                    "  Basing on: %s - %s", str(head.id), str(repo_commit.id)
                 )
                 user_obj = pagure.lib.query.get_user(session, username)
                 commitname = user_obj.fullname or user_obj.user
@@ -1945,7 +1945,7 @@ def merge_pull_request(session, request,
                     author,
                     commit_message,
                     tree,
-                    [head.hex, repo_commit.oid.hex],
+                    [str(head.id), str(repo_commit.id)],
                 )
 
                 _log.info("  New head: %s", commit)
@@ -2151,13 +2151,13 @@ def get_diff_info(repo_obj, orig_repo, b
 
     commitid = None
     if frombranch:
-        commitid = frombranch.peel().hex
+        commitid = str(frombranch.peel().id)
     elif prid is not None:
         # If there is not branch found but there is a PR open, use the ref
         # of that PR in the main repo
         try:
             ref = orig_repo.lookup_reference("refs/pull/%s/head" % prid)
-            commitid = ref.target.hex
+            commitid = str(ref.target)
         except KeyError:
             pass
 
@@ -2179,14 +2179,14 @@ def get_diff_info(repo_obj, orig_repo, b
             "pagure.lib.git.get_diff_info: Pulling into a non-empty repo"
         )
         if branch:
-            orig_commit = orig_repo[branch.peel().hex]
+            orig_commit = orig_repo[str(branch.peel().id)]
             main_walker = orig_repo.walk(
-                orig_commit.oid.hex, pygit2.GIT_SORT_NONE
+                str(orig_commit.id), pygit2.GIT_SORT_NONE
             )
 
         repo_commit = repo_obj[commitid]
         branch_walker = repo_obj.walk(
-            repo_commit.oid.hex, pygit2.GIT_SORT_NONE
+            str(repo_commit.id), pygit2.GIT_SORT_NONE
         )
 
         main_commits = set()
@@ -2197,7 +2197,7 @@ def get_diff_info(repo_obj, orig_repo, b
             if branch:
                 try:
                     com = next(main_walker)
-                    main_commits.add(com.oid.hex)
+                    main_commits.add(str(com.id))
                 except StopIteration:
                     com = None
 
@@ -2211,7 +2211,7 @@ def get_diff_info(repo_obj, orig_repo, b
                 break
 
             if branch_commit:
-                branch_commits.add(branch_commit.oid.hex)
+                branch_commits.add(str(branch_commit.id))
                 diff_commits.append(branch_commit)
             if main_commits.intersection(branch_commits):
                 break
@@ -2221,19 +2221,19 @@ def get_diff_info(repo_obj, orig_repo, b
         i = 0
         if diff_commits and main_commits:
             for i in range(len(diff_commits)):
-                if diff_commits[i].oid.hex in main_commits:
+                if str(diff_commits[i].id) in main_commits:
                     break
             diff_commits = diff_commits[:i]
 
         _log.debug("Diff commits: %s", diff_commits)
         if diff_commits:
-            first_commit = repo_obj[diff_commits[-1].oid.hex]
+            first_commit = repo_obj[str(diff_commits[-1].id)]
             if len(first_commit.parents) > 0:
                 diff = repo_obj.diff(
-                    repo_obj.revparse_single(first_commit.parents[0].oid.hex),
-                    repo_obj.revparse_single(diff_commits[0].oid.hex),
+                    repo_obj.revparse_single(str(first_commit.parents[0].id)),
+                    repo_obj.revparse_single(str(diff_commits[0].id)),
                 )
-            elif first_commit.oid.hex == diff_commits[0].oid.hex:
+            elif str(first_commit.id) == str(diff_commits[0].id):
                 _log.info(
                     "pagure.lib.git.get_diff_info: First commit is also the "
                     "last commit"
@@ -2248,7 +2248,7 @@ def get_diff_info(repo_obj, orig_repo, b
             branch = repo_obj.lookup_branch(branch_from)
             repo_commit = branch.peel()
 
-        for commit in repo_obj.walk(repo_commit.oid.hex, pygit2.GIT_SORT_NONE):
+        for commit in repo_obj.walk(str(repo_commit.id), pygit2.GIT_SORT_NONE):
             diff_commits.append(commit)
 
         _log.debug("Diff commits: %s", diff_commits)
@@ -2309,8 +2309,8 @@ def diff_pull_request(
         # Check if we can still rely on the merge_status
         commenttext = None
         if (
-            request.commit_start != first_commit.oid.hex
-            or request.commit_stop != diff_commits[0].oid.hex
+            request.commit_start != str(first_commit.id)
+            or request.commit_stop != str(diff_commits[0].id)
         ):
             request.merge_status = None
             if request.commit_start:
@@ -2318,7 +2318,7 @@ def diff_pull_request(
                 new_commits_count = 0
                 commenttext = ""
                 for i in diff_commits:
-                    if i.oid.hex == request.commit_stop:
+                    if str(i.id) == request.commit_stop:
                         break
                     new_commits_count = new_commits_count + 1
                     commenttext = "%s * ``%s``\n" % (
@@ -2337,15 +2337,15 @@ def diff_pull_request(
                     )
             if (
                 request.commit_start
-                and request.commit_start != first_commit.oid.hex
+                and request.commit_start != str(first_commit.id)
             ):
                 pr_action = "rebased"
                 if orig_commit:
-                    commenttext = "rebased onto %s" % orig_commit.oid.hex
+                    commenttext = "rebased onto %s" % str(orig_commit.id)
                 else:
                     commenttext = "rebased onto unknown target"
-        request.commit_start = first_commit.oid.hex
-        request.commit_stop = diff_commits[0].oid.hex
+        request.commit_start = str(first_commit.id)
+        request.commit_stop = str(diff_commits[0].id)
         session.add(request)
         session.commit()
         _log.debug(
@@ -2454,7 +2454,7 @@ def get_git_tags(project, with_commits=F
                 if ref:
                     com = ref.peel()
                     if com:
-                        tags[tag.split("refs/tags/")[1]] = com.oid.hex
+                        tags[tag.split("refs/tags/")[1]] = str(com.id)
     else:
         tags = [
             tag.split("refs/tags/")[1]
@@ -2576,7 +2576,7 @@ def log_commits_to_db(session, project,
             user_email=commit.author.email if not author_obj else None,
             project_id=project.id,
             log_type="committed",
-            ref_id=commit.oid.hex,
+            ref_id=str(commit.id),
             date=date_created.date(),
             date_created=date_created.datetime,
         )
@@ -2619,7 +2619,7 @@ def get_git_branches(project, with_commi
             resolved_branch = repo_obj.lookup_branch(branch).resolve()
             com = resolved_branch.peel()
             if com:
-                branches[branch] = com.oid.hex
+                branches[branch] = str(com.id)
     else:
         branches = repo_obj.listall_branches()
 
@@ -2636,7 +2636,7 @@ def get_default_git_branches(project):
     branch = repo_obj.lookup_branch(branchname)
     commit = branch.peel(pygit2.Commit)
 
-    return branchname, commit.oid.hex
+    return branchname, str(commit.id)
 
 
 def new_git_branch(
--- a/pagure/lib/tasks.py
+++ b/pagure/lib/tasks.py
@@ -973,7 +973,7 @@ def commits_author_stats(self, session,
     number_of_commits = 0
     authors_email = set()
     for commit in repo_obj.walk(
-        repo_obj.head.peel().oid.hex, pygit2.GIT_SORT_NONE
+        str(repo_obj.head.peel().id), pygit2.GIT_SORT_NONE
     ):
         # For each commit record how many times each combination of name and
         # e-mail appears in the git history.
@@ -1034,7 +1034,7 @@ def commits_history_stats(self, session,
 
     dates = collections.defaultdict(int)
     for commit in repo_obj.walk(
-        repo_obj.head.peel().oid.hex, pygit2.GIT_SORT_NONE
+        str(repo_obj.head.peel().id), pygit2.GIT_SORT_NONE
     ):
         delta = (
             datetime.datetime.utcnow() - arrow.get(commit.commit_time).naive
@@ -1099,7 +1099,7 @@ def link_pr_to_ticket(self, session, pr_
     user = request.project.user.user if request.project.is_fork else None
 
     for line in pagure.lib.git.read_git_lines(
-        ["log", "--no-walk"] + [c.oid.hex for c in diff_commits] + ["--"],
+        ["log", "--no-walk"] + [str(c.id) for c in diff_commits] + ["--"],
         repopath,
     ):
 
--- a/pagure/ui/filters.py
+++ b/pagure/ui/filters.py
@@ -145,7 +145,7 @@ def format_loc(
 
     commit_hash = commit
     if hasattr(commit_hash, "hex"):
-        commit_hash = commit_hash.hex
+        commit_hash = str(commit_hash.id)
 
     comments = {}
     if prequest and not isinstance(prequest, flask.wrappers.Request):
--- a/pagure/ui/fork.py
+++ b/pagure/ui/fork.py
@@ -280,7 +280,7 @@ def request_pull(repo, requestid, userna
         try:
             for commit in repo_obj.walk(commitid, pygit2.GIT_SORT_NONE):
                 diff_commits.append(commit)
-                if commit.oid.hex == request.commit_start:
+                if str(commit.id) == request.commit_start:
                     break
         except KeyError:
             # This happens when repo.walk() cannot find commitid
@@ -289,19 +289,19 @@ def request_pull(repo, requestid, userna
         if diff_commits:
             # Ensure the first commit in the PR as a parent, otherwise
             # point to it
-            start = diff_commits[-1].oid.hex
+            start = str(diff_commits[-1].id)
             if diff_commits[-1].parents:
-                start = diff_commits[-1].parents[0].oid.hex
+                start = str(diff_commits[-1].parents[0].id)
 
             # If the start and the end commits are the same, it means we are,
             # dealing with one commit that has no parent, so just diff that
             # one commit
-            if start == diff_commits[0].oid.hex:
+            if start == str(diff_commits[0].id):
                 diff = diff_commits[0].tree.diff_to_tree(swap=True)
             else:
                 diff = repo_obj.diff(
                     repo_obj.revparse_single(start),
-                    repo_obj.revparse_single(diff_commits[0].oid.hex),
+                    repo_obj.revparse_single(str(diff_commits[0].id)),
                 )
     else:
         try:
@@ -455,7 +455,7 @@ def request_pull_to_diff_or_patch(
     branch = repo_obj.lookup_branch(request.branch_from)
     commitid = None
     if branch:
-        commitid = branch.peel().hex
+        commitid = str(branch.peel().id)
 
     diff_commits = []
     if request.status != "Open":
@@ -463,7 +463,7 @@ def request_pull_to_diff_or_patch(
         try:
             for commit in repo_obj.walk(commitid, pygit2.GIT_SORT_NONE):
                 diff_commits.append(commit)
-                if commit.oid.hex == request.commit_start:
+                if str(commit.id) == request.commit_start:
                     break
         except KeyError:
             # This happens when repo.walk() cannot find commitid
@@ -1720,13 +1720,13 @@ def new_request_pull(
                         )
 
             if orig_commit:
-                orig_commit = orig_commit.oid.hex
+                orig_commit = str(orig_commit.id)
 
             initial_comment = form.initial_comment.data.strip() or None
             commit_start = commit_stop = None
             if diff_commits:
-                commit_stop = diff_commits[0].oid.hex
-                commit_start = diff_commits[-1].oid.hex
+                commit_stop = str(diff_commits[0].id)
+                commit_start = str(diff_commits[-1].id)
             request = pagure.lib.query.new_pull_request(
                 flask.g.session,
                 repo_to=parent,
@@ -1953,7 +1953,7 @@ def new_remote_request_pull(repo, userna
                         )
 
             if orig_commit:
-                orig_commit = orig_commit.oid.hex
+                orig_commit = str(orig_commit.id)
 
             parent = repo
             if repo.parent:
--- a/pagure/ui/issues.py
+++ b/pagure/ui/issues.py
@@ -1497,7 +1497,7 @@ def view_issue_raw_file(repo, filename=N
         if not content or isinstance(content, pygit2.Tree):
             flask.abort(404, description="File not found")
 
-        data = repo_obj[content.oid].data
+        data = repo_obj[content.id].data
 
         if not data:
             flask.abort(404, description="No content found")
--- a/pagure/ui/repo.py
+++ b/pagure/ui/repo.py
@@ -211,7 +211,7 @@ def view_repo_branch(repo, branchname, u
         head = None
     cnt = 0
     last_commits = []
-    for commit in repo_obj.walk(branch.peel().hex, pygit2.GIT_SORT_NONE):
+    for commit in repo_obj.walk(str(branch.peel().id), pygit2.GIT_SORT_NONE):
         last_commits.append(commit)
         cnt += 1
         if cnt == 3:
@@ -240,19 +240,19 @@ def view_repo_branch(repo, branchname, u
 
         if compare_branch:
             commit_list = [
-                commit.oid.hex
+                str(commit.id)
                 for commit in orig_repo.walk(
-                    compare_branch.peel().hex,
+                    str(compare_branch.peel().id),
                     pygit2.GIT_SORT_NONE)
             ]
 
-        repo_commit = repo_obj[branch.peel().hex]
+        repo_commit = repo_obj[str(branch.peel().id)]
 
         for commit in repo_obj.walk(
-                repo_commit.oid.hex, pygit2.GIT_SORT_NONE):
-            if commit.oid.hex in commit_list:
+                str(repo_commit.id), pygit2.GIT_SORT_NONE):
+            if str(commit.id) in commit_list:
                 break
-            diff_commits.append(commit.oid.hex)
+            diff_commits.append(str(commit.id))
 
         tree = sorted(last_commits[0].tree, key=lambda x: x.filemode)
         for i in tree:
@@ -321,11 +321,11 @@ def view_commits(repo, branchname=None,
         # where we expected a commit, in this case, get the actual commit
         if isinstance(commit, pygit2.Tag):
             commit = commit.peel(pygit2.Commit)
-            branchname = commit.oid.hex
+            branchname = str(commit.id)
         elif isinstance(commit, pygit2.Blob):
             try:
                 commit = commit.peel(pygit2.Commit)
-                branchname = commit.oid.hex
+                branchname = str(commit.id)
             except Exception:
                 flask.abort(
                     404, description="Invalid branch/identifier provided"
@@ -362,7 +362,7 @@ def view_commits(repo, branchname=None,
     n_commits = 0
     last_commits = []
     if commit:
-        for commit in repo_obj.walk(commit.hex, pygit2.GIT_SORT_NONE):
+        for commit in repo_obj.walk(str(commit.id), pygit2.GIT_SORT_NONE):
 
             # Filters the commits for a user
             if author_obj:
@@ -413,7 +413,7 @@ def view_commits(repo, branchname=None,
             )
 
             for commit in diff_commits_full:
-                diff_commits.append(commit.oid.hex)
+                diff_commits.append(str(commit.id))
 
     return flask.render_template(
         "commits.html",
@@ -469,7 +469,7 @@ def compare_commits(repo, commit1, commi
     last_commit = commit2
 
     commits = [
-        commit.oid.hex[: len(first_commit)]
+        str(commit.id)[: len(first_commit)]
         for commit in repo_obj.walk(last_commit, pygit2.GIT_SORT_NONE)
     ]
 
@@ -480,7 +480,7 @@ def compare_commits(repo, commit1, commi
     for commit in repo_obj.walk(last_commit, order):
         diff_commits.append(commit)
 
-        if commit.oid.hex == first_commit or commit.oid.hex.startswith(
+        if str(commit.id) == first_commit or str(commit.id).startswith(
             first_commit
         ):
             break
@@ -549,7 +549,7 @@ def view_file(repo, identifier, filename
         )
         if not content:
             flask.abort(404, description="File not found")
-        content = repo_obj[content.oid]
+        content = repo_obj[content.id]
     else:
         content = commit
 
@@ -714,7 +714,7 @@ def view_raw_file(
         if not content or isinstance(content, pygit2.Tree):
             flask.abort(404, description="File not found")
 
-        data = repo_obj[content.oid].data
+        data = repo_obj[content.id].data
     else:
         if commit.parents:
             # We need to take this not so nice road to ensure that the
@@ -801,7 +801,7 @@ def view_blame_file(repo, filename, user
         _log.exception("File could not be decoded")
         flask.abort(500, description="File could not be decoded")
 
-    blame = repo_obj.blame(filename, newest_commit=commit.oid.hex)
+    blame = repo_obj.blame(filename, newest_commit=str(commit.id))
 
     return flask.render_template(
         "blame.html",
@@ -913,7 +913,7 @@ def view_commit(repo, commitid, username
                 repo=repo.name,
                 username=username,
                 namespace=repo.namespace,
-                commitid=commit.hex,
+                commitid=str(commit.id),
             )
         )
 
@@ -1059,7 +1059,7 @@ def view_tree(repo, identifier=None, use
         # where we expected a commit, in this case, get the actual commit
         if isinstance(commit, pygit2.Tag):
             commit = commit.peel(pygit2.Commit)
-            branchname = commit.oid.hex
+            branchname = str(commit.id)
 
         if commit and not isinstance(commit, pygit2.Blob):
             content = sorted(commit.tree, key=lambda x: x.filemode)
@@ -2619,7 +2619,7 @@ def edit_file(repo, branchname, filename
             flask.abort(400, description="Cannot edit binary files")
 
         try:
-            data = repo_obj[content.oid].data.decode("utf-8")
+            data = repo_obj[content.id].data.decode("utf-8")
         except UnicodeDecodeError:  # pragma: no cover
             # In theory we shouldn't reach here since we check if the file
             # is binary with `is_binary_string()` above
@@ -3629,7 +3629,7 @@ def generate_project_archive(
         archive_folder,
         flask.g.repo.fullname,
         tag_path,
-        commit.oid.hex,
+        str(commit.id),
         "%s.%s" % (name, extension),
     )
     headers = {
@@ -3652,7 +3652,7 @@ def generate_project_archive(
         repo,
         namespace=namespace,
         username=username,
-        commit=commit.oid.hex,
+        commit=str(commit.id),
         tag=tag_filename,
         name=name,
         archive_fmt=extension,
--- a/pagure/utils.py
+++ b/pagure/utils.py
@@ -433,12 +433,12 @@ def __get_file_in_tree(repo_obj, tree, f
                         pass
                     else:
                         if dereferenced.filemode == pygit2.GIT_FILEMODE_BLOB:
-                            blob = repo_obj[dereferenced.oid]
+                            blob = repo_obj[dereferenced.id]
 
                 return blob
             else:
                 try:
-                    nextitem = repo_obj[entry.oid]
+                    nextitem = repo_obj[entry.id]
                 except KeyError:
                     # We could not find the blob/entry in the git repo
                     # so we bail
--- a/tests/__init__.py
+++ b/tests/__init__.py
@@ -779,13 +779,13 @@ def _clone_and_top_commits(folder, branc
     commit = None
     try:
         if branch_ref_obj:
-            commit = repo[branch_ref_obj.peel().hex]
+            commit = repo[str(branch_ref_obj.peel().id)]
         else:
             commit = repo.revparse_single("HEAD")
     except KeyError:
         pass
     if commit:
-        parents = [commit.oid.hex]
+        parents = [str(commit.id)]
 
     return (repo, newfolder, parents)
 
@@ -822,7 +822,7 @@ def add_content_git_repo(folder, branch=
     )
 
     if commit:
-        parents = [commit.hex]
+        parents = [str(commit)]
 
     subfolder = os.path.join("folder1", "folder2")
     if not os.path.exists(os.path.join(newfolder, subfolder)):
@@ -949,13 +949,13 @@ def add_commit_git_repo(
         commit = None
         try:
             if branch_ref_obj:
-                commit = repo[branch_ref_obj.peel().hex]
+                commit = repo[str(branch_ref_obj.peel().id)]
             else:
                 commit = repo.revparse_single("HEAD")
         except (KeyError, AttributeError):
             pass
         if commit:
-            parents = [commit.oid.hex]
+            parents = [str(commit.id)]
 
         # Commits the files added
         tree = repo.index.write_tree()
@@ -1036,13 +1036,13 @@ def add_content_to_git(
     commit = None
     try:
         if branch_ref_obj:
-            commit = repo[branch_ref_obj.peel().hex]
+            commit = repo[str(branch_ref_obj.peel().id)]
         else:
             commit = repo.revparse_single("HEAD")
     except (KeyError, AttributeError):
         pass
     if commit:
-        parents = [commit.oid.hex]
+        parents = [str(commit.id)]
 
     # Commits the files added
     tree = repo.index.write_tree()
@@ -1217,7 +1217,7 @@ def add_pull_request_git_repo(
         committer,
         "A commit on branch %s" % branch_from,
         tree,
-        [first_commit.oid.hex],
+        [str(first_commit.id)],
     )
     refname = "refs/heads/%s" % (branch_from)
     ori_remote = clone_repo.remotes[0]
--- a/tests/test_pagure_flask_api_project.py
+++ b/tests/test_pagure_flask_api_project.py
@@ -94,7 +94,7 @@ class PagureFlaskApiProjecttests(tests.M
         tagger = pygit2.Signature("Alice Doe", "adoe@example.com", 12347, 0)
         repo.create_tag(
             "0.0.1",
-            first_commit.oid.hex,
+            str(first_commit.id),
             pygit2.GIT_OBJ_COMMIT,
             tagger,
             "Release 0.0.1",
@@ -2730,7 +2730,7 @@ class PagureFlaskApiProjecttests(tests.M
         tests.create_tokens(self.session, project_id=None)
         tests.create_tokens_acl(self.session, "aaabbbcccddd", "create_branch")
         repo_obj = pygit2.Repository(git_path)
-        from_commit = repo_obj.revparse_single("HEAD").oid.hex
+        from_commit = str(repo_obj.revparse_single("HEAD").id)
         headers = {"Authorization": "token aaabbbcccddd"}
         args = {"branch": "test123", "from_commit": from_commit}
         output = self.app.post(
@@ -2771,7 +2771,7 @@ class PagureFlaskApiProjectFlagtests(tes
             "uid": "jenkins_build_pagure_100+seed",
         }
         output = self.app.post(
-            "/api/0/test/c/%s/flag" % commit.oid.hex,
+            "/api/0/test/c/%s/flag" % str(commit.id),
             headers=headers,
             data=data,
         )
@@ -2800,7 +2800,7 @@ class PagureFlaskApiProjectFlagtests(tes
             "status": "success",
         }
         output = self.app.post(
-            "/api/0/test/c/%s/flag" % commit.oid.hex,
+            "/api/0/test/c/%s/flag" % str(commit.id),
             headers=headers,
             data=data,
         )
@@ -2827,7 +2827,7 @@ class PagureFlaskApiProjectFlagtests(tes
             "status": "success",
         }
         output = self.app.post(
-            "/api/0/test/c/%s/flag" % commit.oid.hex,
+            "/api/0/test/c/%s/flag" % str(commit.id),
             headers=headers,
             data=data,
         )
@@ -2854,7 +2854,7 @@ class PagureFlaskApiProjectFlagtests(tes
             "status": "success",
         }
         output = self.app.post(
-            "/api/0/test/c/%s/flag" % commit.oid.hex,
+            "/api/0/test/c/%s/flag" % str(commit.id),
             headers=headers,
             data=data,
         )
@@ -2881,7 +2881,7 @@ class PagureFlaskApiProjectFlagtests(tes
             "uid": "jenkins_build_pagure_100+seed",
         }
         output = self.app.post(
-            "/api/0/test/c/%s/flag" % commit.oid.hex,
+            "/api/0/test/c/%s/flag" % str(commit.id),
             headers=headers,
             data=data,
         )
@@ -2910,7 +2910,7 @@ class PagureFlaskApiProjectFlagtests(tes
             "status": "foobar",
         }
         output = self.app.post(
-            "/api/0/test/c/%s/flag" % commit.oid.hex,
+            "/api/0/test/c/%s/flag" % str(commit.id),
             headers=headers,
             data=data,
         )
@@ -2940,7 +2940,7 @@ class PagureFlaskApiProjectFlagtests(tes
             "status": "success",
         }
         output = self.app.post(
-            "/api/0/test/c/%s/flag" % commit.oid.hex,
+            "/api/0/test/c/%s/flag" % str(commit.id),
             headers=headers,
             data=data,
         )
@@ -3037,7 +3037,7 @@ class PagureFlaskApiProjectFlagtests(tes
                         "milestones": {},
                     },
                     "flag": {
-                        "commit_hash": commit.oid.hex,
+                        "commit_hash": str(commit.id),
                         "username": "Jenkins",
                         "percent": "0",
                         "comment": "Tests running",
@@ -3057,7 +3057,7 @@ class PagureFlaskApiProjectFlagtests(tes
             )
         ):
             output = self.app.post(
-                "/api/0/test/c/%s/flag" % commit.oid.hex,
+                "/api/0/test/c/%s/flag" % str(commit.id),
                 headers=headers,
                 data=data,
             )
@@ -3068,7 +3068,7 @@ class PagureFlaskApiProjectFlagtests(tes
         expected_output = {
             "flag": {
                 "comment": "Tests running",
-                "commit_hash": commit.oid.hex,
+                "commit_hash": str(commit.id),
                 "date_created": "1510742565",
                 "date_updated": "1510742565",
                 "percent": 0,
@@ -3144,7 +3144,7 @@ class PagureFlaskApiProjectFlagtests(tes
                         "milestones": {},
                     },
                     "flag": {
-                        "commit_hash": commit.oid.hex,
+                        "commit_hash": str(commit.id),
                         "username": "Jenkins",
                         "percent": "100",
                         "comment": "Tests passed",
@@ -3164,7 +3164,7 @@ class PagureFlaskApiProjectFlagtests(tes
             )
         ):
             output = self.app.post(
-                "/api/0/test/c/%s/flag" % commit.oid.hex,
+                "/api/0/test/c/%s/flag" % str(commit.id),
                 headers=headers,
                 data=data,
             )
@@ -3175,7 +3175,7 @@ class PagureFlaskApiProjectFlagtests(tes
         expected_output = {
             "flag": {
                 "comment": "Tests passed",
-                "commit_hash": commit.oid.hex,
+                "commit_hash": str(commit.id),
                 "date_created": "1510742565",
                 "date_updated": "1510742565",
                 "percent": 100,
@@ -3215,7 +3215,7 @@ class PagureFlaskApiProjectFlagtests(tes
             "status": "success",
         }
         output = self.app.post(
-            "/api/0/test/c/%s/flag" % commit.oid.hex,
+            "/api/0/test/c/%s/flag" % str(commit.id),
             headers=headers,
             data=data,
         )
@@ -3228,7 +3228,7 @@ class PagureFlaskApiProjectFlagtests(tes
         expected_output = {
             "flag": {
                 "comment": "Tests passed",
-                "commit_hash": commit.oid.hex,
+                "commit_hash": str(commit.id),
                 "date_created": "1510742565",
                 "date_updated": "1510742565",
                 "percent": 100,
@@ -3276,7 +3276,7 @@ class PagureFlaskApiProjectFlagtests(tes
         }
 
         output = self.app.post(
-            "/api/0/test/c/%s/flag" % commit.oid.hex,
+            "/api/0/test/c/%s/flag" % str(commit.id),
             headers=headers,
             data=data,
         )
@@ -3289,7 +3289,7 @@ class PagureFlaskApiProjectFlagtests(tes
         expected_output = {
             "flag": {
                 "comment": "Tests passed",
-                "commit_hash": commit.oid.hex,
+                "commit_hash": str(commit.id),
                 "date_created": "1510742565",
                 "date_updated": "1510742565",
                 "percent": 100,
@@ -3312,10 +3312,10 @@ class PagureFlaskApiProjectFlagtests(tes
 
         mock_email.assert_called_once_with(
             "\nJenkins flagged the commit "
-            "`" + commit.oid.hex + "` as success: "
+            "`" + str(commit.id) + "` as success: "
             "Tests passed\n\n"
-            "http://localhost.localdomain/test/c/" + commit.oid.hex + "\n",
-            "Commit #" + commit.oid.hex + " - Jenkins: success",
+            "http://localhost.localdomain/test/c/" + str(commit.id) + "\n",
+            "Commit #" + str(commit.id) + " - Jenkins: success",
             "bar@pingou.com",
             in_reply_to="test-project-1",
             mail_id="test-commit-1-1",
@@ -3351,7 +3351,7 @@ class PagureFlaskApiProjectFlagtests(tes
             "status": "succeed!",
         }
         output = self.app.post(
-            "/api/0/test/c/%s/flag" % commit.oid.hex,
+            "/api/0/test/c/%s/flag" % str(commit.id),
             headers=headers,
             data=send_data,
         )
@@ -3362,7 +3362,7 @@ class PagureFlaskApiProjectFlagtests(tes
         # Try invalid flag status
         send_data["status"] = "nooooo...."
         output = self.app.post(
-            "/api/0/test/c/%s/flag" % commit.oid.hex,
+            "/api/0/test/c/%s/flag" % str(commit.id),
             headers=headers,
             data=send_data,
         )
@@ -3384,7 +3384,7 @@ class PagureFlaskApiProjectFlagtests(tes
         commit = repo_obj.revparse_single("HEAD")
 
         # test with no flags
-        output = self.app.get("/api/0/test/c/%s/flag" % commit.oid.hex)
+        output = self.app.get("/api/0/test/c/%s/flag" % str(commit.id))
         self.assertEqual(
             json.loads(output.get_data(as_text=True)),
             {"total_flags": 0, "flags": []},
@@ -3395,7 +3395,7 @@ class PagureFlaskApiProjectFlagtests(tes
         pagure.lib.query.add_commit_flag(
             session=self.session,
             repo=repo,
-            commit_hash=commit.oid.hex,
+            commit_hash=str(commit.id),
             username="simple-koji-ci",
             status="pending",
             percent=None,
@@ -3409,7 +3409,7 @@ class PagureFlaskApiProjectFlagtests(tes
         pagure.lib.query.add_commit_flag(
             session=self.session,
             repo=repo,
-            commit_hash=commit.oid.hex,
+            commit_hash=str(commit.id),
             username="complex-koji-ci",
             status="success",
             percent=None,
@@ -3421,7 +3421,7 @@ class PagureFlaskApiProjectFlagtests(tes
         )
         self.session.commit()
 
-        output = self.app.get("/api/0/test/c/%s/flag" % commit.oid.hex)
+        output = self.app.get("/api/0/test/c/%s/flag" % str(commit.id))
         data = json.loads(output.get_data(as_text=True))
 
         for f in data["flags"]:
@@ -5007,7 +5007,7 @@ class PagureFlaskApiProjectCommitInfotes
     def test_api_commit_info(self):
         """ Test flagging a commit with missing precentage. """
 
-        output = self.app.get("/api/0/test/c/%s/info" % self.commit.oid.hex)
+        output = self.app.get("/api/0/test/c/%s/info" % str(self.commit.id))
         self.assertEqual(output.status_code, 200)
         data = json.loads(output.get_data(as_text=True))
         expected_output = {
@@ -5015,10 +5015,10 @@ class PagureFlaskApiProjectCommitInfotes
             "commit_time": self.commit.commit_time,
             "commit_time_offset": self.commit.commit_time_offset,
             "committer": "Cecil Committer",
-            "hash": self.commit.oid.hex,
+            "hash": str(self.commit.id),
             "message": "Add some directory and a file for more testing",
-            "parent_ids": [self.commit.parent_ids[0].hex],
-            "tree_id": self.commit.tree_id.hex,
+            "parent_ids": [str(self.commit.parent_ids[0])],
+            "tree_id": str(self.commit.tree_id),
         }
 
         self.assertEqual(data, expected_output)
@@ -5037,7 +5037,7 @@ class PagureFlaskApiProjectCommitInfotes
     def test_api_commit_info_hash_tree(self):
         """ Test flagging a commit with missing username. """
         output = self.app.get(
-            "/api/0/test/c/%s/info" % self.commit.tree_id.hex
+            "/api/0/test/c/%s/info" % str(self.commit.tree_id)
         )
 
         self.assertEqual(output.status_code, 404)
@@ -5108,12 +5108,12 @@ class PagureFlaskApiProjectGitBrancheste
             data,
             {
                 "branches": {
-                    "master": self.commit.hex,
-                    "pats-win-49": self.commit.hex,
-                    "pats-win-51": self.commit.hex,
+                    "master": str(self.commit.id),
+                    "pats-win-49": str(self.commit.id),
+                    "pats-win-51": str(self.commit.id),
                 },
                 "default": {
-                    "master": self.commit.hex,
+                    "master": str(self.commit.id),
                 },
                 "total_branches": 3,
             },
@@ -5162,12 +5162,12 @@ class PagureFlaskApiProjectGitBrancheste
             data,
             {
                 "branches": {
-                    "master": self.commit.hex,
-                    "pats-win-49": self.commit.hex,
-                    "pats-win-51": self.commit.hex,
+                    "master": str(self.commit.id),
+                    "pats-win-49": str(self.commit.id),
+                    "pats-win-51": str(self.commit.id),
                 },
                 "default": {
-                    "pats-win-49": self.commit.hex,
+                    "pats-win-49": str(self.commit.id),
                 },
                 "total_branches": 3,
             },
@@ -5188,12 +5188,12 @@ class PagureFlaskApiProjectGitBrancheste
             data,
             {
                 "branches": {
-                    "master": self.commit.hex,
-                    "pats-win-49": self.commit.hex,
-                    "pats-win-51": self.commit.hex,
+                    "master": str(self.commit.id),
+                    "pats-win-49": str(self.commit.id),
+                    "pats-win-51": str(self.commit.id),
                 },
                 "default": {
-                    "pats-win-49": self.commit.hex,
+                    "pats-win-49": str(self.commit.id),
                 },
                 "total_branches": 3,
             },
--- a/tests/test_pagure_flask_api_project_git_tags.py
+++ b/tests/test_pagure_flask_api_project_git_tags.py
@@ -87,7 +87,7 @@ class PagureFlaskApiProjectGitTagstests(
         latest_commit = repo.revparse_single("HEAD")
         data = {
             "tagname": "test-tag-no-message",
-            "commit_hash": latest_commit.oid.hex,
+            "commit_hash": str(latest_commit.id),
             "message": None,
         }
 
@@ -108,7 +108,7 @@ class PagureFlaskApiProjectGitTagstests(
         data = json.loads(output.get_data(as_text=True))
         self.assertEqual(sorted(data.keys()), ["tags", "total_tags"])
         self.assertEqual(
-            data["tags"], {"test-tag-no-message": latest_commit.oid.hex}
+            data["tags"], {"test-tag-no-message": str(latest_commit.id)}
         )
         self.assertEqual(data["total_tags"], 1)
 
@@ -128,7 +128,7 @@ class PagureFlaskApiProjectGitTagstests(
         latest_commit = repo.revparse_single("HEAD")
         data = {
             "tagname": "test-tag-no-message",
-            "commit_hash": latest_commit.oid.hex,
+            "commit_hash": str(latest_commit.id),
             "message": None,
             "with_commits": True,
         }
@@ -142,7 +142,7 @@ class PagureFlaskApiProjectGitTagstests(
             sorted(data.keys()), ["tag_created", "tags", "total_tags"]
         )
         self.assertEqual(
-            data["tags"], {"test-tag-no-message": latest_commit.oid.hex}
+            data["tags"], {"test-tag-no-message": str(latest_commit.id)}
         )
         self.assertEqual(data["total_tags"], 1)
         self.assertEqual(data["tag_created"], True)
@@ -163,7 +163,7 @@ class PagureFlaskApiProjectGitTagstests(
         latest_commit = repo.revparse_single("HEAD")
         data = {
             "tagname": "test-tag-no-message",
-            "commit_hash": latest_commit.oid.hex,
+            "commit_hash": str(latest_commit.id),
             "message": "This is a long annotation\nover multiple lines\n for testing",
         }
 
@@ -195,7 +195,7 @@ class PagureFlaskApiProjectGitTagstests(
         latest_commit = repo.revparse_single("HEAD")
         data = {
             "tagname": "test-tag-no-message",
-            "commit_hash": latest_commit.oid.hex,
+            "commit_hash": str(latest_commit.id),
             "message": "This is a long annotation\nover multiple lines\n for testing",
         }
 
@@ -214,7 +214,7 @@ class PagureFlaskApiProjectGitTagstests(
         # Submit the same request/tag a second time to the same commit
         data = {
             "tagname": "test-tag-no-message",
-            "commit_hash": latest_commit.oid.hex,
+            "commit_hash": str(latest_commit.id),
             "message": "This is a long annotation\nover multiple lines\n for testing",
         }
 
@@ -253,7 +253,7 @@ class PagureFlaskApiProjectGitTagstests(
         latest_commit = repo.revparse_single("HEAD")
         data = {
             "tagname": "test-tag-no-message",
-            "commit_hash": latest_commit.oid.hex,
+            "commit_hash": str(latest_commit.id),
             "message": "This is a long annotation\nover multiple lines\n for testing",
         }
 
@@ -291,7 +291,7 @@ class PagureFlaskApiProjectGitTagstests(
         latest_commit = repo.revparse_single("HEAD")
         data = {
             "tagname": "test-tag-no-message",
-            "commit_hash": latest_commit.oid.hex,
+            "commit_hash": str(latest_commit.id),
             "message": "This is a long annotation\nover multiple lines\n for testing",
         }
 
@@ -321,7 +321,7 @@ class PagureFlaskApiProjectGitTagstests(
         # Add a tag so that we can list it
         repo = pygit2.Repository(os.path.join(self.path, "repos", "test.git"))
         latest_commit = repo.revparse_single("HEAD")
-        prev_commit = latest_commit.parents[0].oid.hex
+        prev_commit = str(latest_commit.parents[0].id)
         data = {
             "tagname": "test-tag-no-message",
             "commit_hash": prev_commit,
@@ -344,7 +344,7 @@ class PagureFlaskApiProjectGitTagstests(
         # Submit the same request/tag a second time to the same commit
         data = {
             "tagname": "test-tag-no-message",
-            "commit_hash": latest_commit.oid.hex,
+            "commit_hash": str(latest_commit.id),
             "message": "This is a long annotation\nover multiple lines\n for testing",
             "with_commits": True,
             "force": True,
@@ -359,7 +359,7 @@ class PagureFlaskApiProjectGitTagstests(
             sorted(data.keys()), ["tag_created", "tags", "total_tags"]
         )
         self.assertEqual(
-            data["tags"], {"test-tag-no-message": latest_commit.oid.hex}
+            data["tags"], {"test-tag-no-message": str(latest_commit.id)}
         )
         self.assertEqual(data["total_tags"], 1)
         self.assertEqual(data["tag_created"], True)
--- a/tests/test_pagure_flask_api_project_view_file.py
+++ b/tests/test_pagure_flask_api_project_view_file.py
@@ -242,7 +242,7 @@ class PagureFlaskApiProjectViewFiletests
         repo = pygit2.Repository(os.path.join(self.path, "repos", "test.git"))
         commit = repo.revparse_single("HEAD")
 
-        output = self.app.get("/api/0/test/tree/%s" % commit.oid.hex)
+        output = self.app.get("/api/0/test/tree/%s" % str(commit.id))
         self.assertEqual(output.status_code, 200)
         data = json.loads(output.get_data(as_text=True))
         self.assertDictEqual(
@@ -251,7 +251,7 @@ class PagureFlaskApiProjectViewFiletests
                 "content": [
                     {
                         "content_url": "http://localhost/test/raw/"
-                        "%s/f/README.rst" % commit.oid.hex,
+                        "%s/f/README.rst" % str(commit.id),
                         "name": "README.rst",
                         "path": "README.rst",
                         "type": "file",
@@ -270,7 +270,7 @@ class PagureFlaskApiProjectViewFiletests
         commit = repo.revparse_single("HEAD")
 
         output = self.app.get(
-            "/api/0/test/tree/%s/f/folder1" % commit.tree.oid.hex
+            "/api/0/test/tree/%s/f/folder1" % str(commit.tree.id)
         )
         self.assertEqual(output.status_code, 200)
         data = json.loads(output.get_data(as_text=True))
@@ -280,7 +280,7 @@ class PagureFlaskApiProjectViewFiletests
                 "content": [
                     {
                         "content_url": "http://localhost/api/0/test/tree/"
-                        "%s/f/folder1/folder2" % commit.tree.oid.hex,
+                        "%s/f/folder1/folder2" % str(commit.tree.id),
                         "name": "folder2",
                         "path": "folder1/folder2",
                         "type": "folder",
@@ -297,13 +297,13 @@ class PagureFlaskApiProjectViewFiletests
         tagger = pygit2.Signature("Alice Doe", "adoe@example.com", 12347, 0)
         tag = repo.create_tag(
             "v1.0_tag",
-            commit.oid.hex,
+            str(commit.id),
             pygit2.GIT_OBJ_COMMIT,
             tagger,
             "Release v1.0",
         )
 
-        output = self.app.get("/api/0/test/tree/%s" % tag.hex)
+        output = self.app.get("/api/0/test/tree/%s" % str(tag))
         self.assertEqual(output.status_code, 200)
         data = json.loads(output.get_data(as_text=True))
         self.assertDictEqual(
@@ -312,7 +312,7 @@ class PagureFlaskApiProjectViewFiletests
                 "content": [
                     {
                         "content_url": "http://localhost/test/raw/"
-                        "%s/f/README.rst" % tag.hex,
+                        "%s/f/README.rst" % str(tag),
                         "name": "README.rst",
                         "path": "README.rst",
                         "type": "file",
--- a/tests/test_pagure_flask_api_ui_private_repo.py
+++ b/tests/test_pagure_flask_api_ui_private_repo.py
@@ -324,7 +324,7 @@ class PagurePrivateRepotest(tests.Modelt
                 # binary string representing the tree object ID
                 tree,
                 # list of binary strings representing parents of the new commit
-                [first_commit.oid.hex],
+                [str(first_commit.id)],
             )
             refname = "refs/heads/master:refs/heads/master"
             ori_remote = clone_repo.remotes[0]
@@ -350,7 +350,7 @@ class PagurePrivateRepotest(tests.Modelt
                 # binary string representing the tree object ID
                 tree,
                 # list of binary strings representing parents of the new commit
-                [first_commit.oid.hex],
+                [str(first_commit.id)],
             )
             refname = "refs/heads/master:refs/heads/master"
             ori_remote = clone_repo.remotes[0]
@@ -387,7 +387,7 @@ class PagurePrivateRepotest(tests.Modelt
                 committer,
                 "A commit on branch %s" % branch_from,
                 tree,
-                [first_commit.oid.hex],
+                [str(first_commit.id)],
             )
             refname = "refs/heads/%s" % (branch_from)
             ori_remote = repo.remotes[0]
@@ -1232,7 +1232,7 @@ class PagurePrivateRepotest(tests.Modelt
         tagger = pygit2.Signature("Alice Doe", "adoe@example.com", 12347, 0)
         repo.create_tag(
             "0.0.1",
-            first_commit.oid.hex,
+            str(first_commit.id),
             pygit2.GIT_OBJ_COMMIT,
             tagger,
             "Release 0.0.1",
--- a/tests/test_pagure_flask_internal.py
+++ b/tests/test_pagure_flask_internal.py
@@ -481,7 +481,7 @@ class PagureFlaskInternaltests(tests.Mod
             # binary string representing the tree object ID
             tree,
             # list of binary strings representing parents of the new commit
-            [first_commit.oid.hex],
+            [str(first_commit.id)],
         )
 
         second_commit = repo.revparse_single("HEAD")
@@ -602,7 +602,7 @@ class PagureFlaskInternaltests(tests.Mod
             # binary string representing the tree object ID
             tree,
             # list of binary strings representing parents of the new commit
-            [first_commit.oid.hex],
+            [str(first_commit.id)],
         )
 
         second_commit = repo.revparse_single("HEAD")
@@ -726,7 +726,7 @@ class PagureFlaskInternaltests(tests.Mod
             # binary string representing the tree object ID
             tree,
             # list of binary strings representing parents of the new commit
-            [first_commit.oid.hex],
+            [str(first_commit.id)],
         )
         refname = "refs/heads/feature:refs/heads/feature"
         ori_remote = repo.remotes[0]
@@ -750,7 +750,7 @@ class PagureFlaskInternaltests(tests.Mod
             # binary string representing the tree object ID
             tree,
             # list of binary strings representing parents of the new commit
-            [first_commit.oid.hex],
+            [str(first_commit.id)],
         )
         refname = "refs/heads/master:refs/heads/master"
         ori_remote = repo.remotes[0]
@@ -891,7 +891,7 @@ class PagureFlaskInternaltests(tests.Mod
             # binary string representing the tree object ID
             tree,
             # list of binary strings representing parents of the new commit
-            [first_commit.oid.hex],
+            [str(first_commit.id)],
         )
         refname = "refs/heads/feature:refs/heads/feature"
         ori_remote = repo.remotes[0]
@@ -915,7 +915,7 @@ class PagureFlaskInternaltests(tests.Mod
             # binary string representing the tree object ID
             tree,
             # list of binary strings representing parents of the new commit
-            [first_commit.oid.hex],
+            [str(first_commit.id)],
         )
         refname = "refs/heads/master:refs/heads/master"
         ori_remote = repo.remotes[0]
@@ -1040,7 +1040,7 @@ class PagureFlaskInternaltests(tests.Mod
             # binary string representing the tree object ID
             tree,
             # list of binary strings representing parents of the new commit
-            [first_commit.oid.hex],
+            [str(first_commit.id)],
         )
         refname = "refs/heads/feature:refs/heads/feature"
         ori_remote = repo.remotes[0]
@@ -1064,7 +1064,7 @@ class PagureFlaskInternaltests(tests.Mod
             # binary string representing the tree object ID
             tree,
             # list of binary strings representing parents of the new commit
-            [first_commit.oid.hex],
+            [str(first_commit.id)],
         )
         refname = "refs/heads/master:refs/heads/master"
         ori_remote = repo.remotes[0]
@@ -1200,7 +1200,7 @@ class PagureFlaskInternaltests(tests.Mod
             # binary string representing the tree object ID
             tree,
             # list of binary strings representing parents of the new commit
-            [first_commit.oid.hex],
+            [str(first_commit.id)],
         )
         refname = "refs/heads/feature:refs/heads/feature"
         ori_remote = repo.remotes[0]
@@ -1342,7 +1342,7 @@ class PagureFlaskInternaltests(tests.Mod
             # binary string representing the tree object ID
             tree,
             # list of binary strings representing parents of the new commit
-            [first_commit.oid.hex],
+            [str(first_commit.id)],
         )
         refname = "refs/heads/feature:refs/heads/feature"
         ori_remote = repo.remotes[0]
@@ -1366,7 +1366,7 @@ class PagureFlaskInternaltests(tests.Mod
             # binary string representing the tree object ID
             tree,
             # list of binary strings representing parents of the new commit
-            [first_commit.oid.hex],
+            [str(first_commit.id)],
         )
         refname = "refs/heads/master:refs/heads/master"
         ori_remote = repo.remotes[0]
@@ -1477,7 +1477,7 @@ class PagureFlaskInternaltests(tests.Mod
             # binary string representing the tree object ID
             tree,
             # list of binary strings representing parents of the new commit
-            [first_commit.oid.hex],
+            [str(first_commit.id)],
         )
         refname = "refs/heads/feature:refs/heads/feature"
         ori_remote = repo.remotes[0]
@@ -1501,7 +1501,7 @@ class PagureFlaskInternaltests(tests.Mod
             # binary string representing the tree object ID
             tree,
             # list of binary strings representing parents of the new commit
-            [first_commit.oid.hex],
+            [str(first_commit.id)],
         )
         refname = "refs/heads/master:refs/heads/master"
         ori_remote = repo.remotes[0]
@@ -1669,7 +1669,7 @@ class PagureFlaskInternaltests(tests.Mod
             # binary string representing the tree object ID
             tree,
             # list of binary strings representing parents of the new commit
-            [first_commit.oid.hex],
+            [str(first_commit.id)],
         )
 
         # Create another file in the master branch
@@ -1690,7 +1690,7 @@ class PagureFlaskInternaltests(tests.Mod
             # binary string representing the tree object ID
             tree,
             # list of binary strings representing parents of the new commit
-            [first_commit.oid.hex],
+            [str(first_commit.id)],
         )
 
         # All good but the commit id
@@ -1777,7 +1777,7 @@ class PagureFlaskInternaltests(tests.Mod
             # list of binary strings representing parents of the new commit
             [],
         )
-        commit_hash = commit.hex
+        commit_hash = str(commit)
 
         # All good
         data = {
@@ -1905,7 +1905,7 @@ class PagureFlaskInternaltests(tests.Mod
             # binary string representing the tree object ID
             tree,
             # list of binary strings representing parents of the new commit
-            [first_commit.oid.hex],
+            [str(first_commit.id)],
         )
 
         # Create another file in the master branch
@@ -1926,7 +1926,7 @@ class PagureFlaskInternaltests(tests.Mod
             # binary string representing the tree object ID
             tree,
             # list of binary strings representing parents of the new commit
-            [first_commit.oid.hex],
+            [str(first_commit.id)],
         )
 
         # All good
--- a/tests/test_pagure_flask_rebase.py
+++ b/tests/test_pagure_flask_rebase.py
@@ -253,7 +253,7 @@ class PagureRebasetests(PagureRebaseBase
             orig_repo_obj = pygit2.Repository(
                 os.path.join(self.path, "repos", "test.git")
             )
-            orig_commit = orig_repo_obj.lookup_branch("master").peel().hex
+            orig_commit = str(orig_repo_obj.lookup_branch("master").peel().id)
             expected = f'rebased onto <a href="/test/c/{orig_commit}"'
             self.assertIn(expected, output_text)
             repo = pagure.lib.query._get_project(self.session, "test")
--- a/tests/test_pagure_flask_ui_app.py
+++ b/tests/test_pagure_flask_ui_app.py
@@ -980,11 +980,11 @@ class PagureFlaskApptests(tests.Modeltes
         repo = pygit2.Repository(repopath)
         first_commit = repo.revparse_single("HEAD")
 
-        text = "Cf commit %s" % first_commit.oid.hex
+        text = "Cf commit %s" % str(first_commit.id)
         exp = (
             '<div class="markdown"><p>Cf commit <a href="/test/c/{0}" title="Commit {0}">{1}'
             "</a></p></div>".format(
-                first_commit.oid.hex, first_commit.oid.hex[:7]
+                str(first_commit.id), str(first_commit.id)[:7]
             )
         )
 
--- a/tests/test_pagure_flask_ui_archives.py
+++ b/tests/test_pagure_flask_ui_archives.py
@@ -152,7 +152,7 @@ class PagureFlaskUiArchivesTest(tests.Mo
             symlink_to=symlinkdir_target,
         )
         tests.add_readme_git_repo(repopath)
-        commit = repo.head.target.hex
+        commit = str(repo.head.target)
 
         with mock.patch.dict(
             "pagure.config.config",
@@ -360,7 +360,7 @@ class PagureFlaskUiArchivesTest(tests.Mo
         """ Test getting the archive from a commit. """
         repopath = os.path.join(self.path, "repos", "test.git")
         repo = pygit2.Repository(repopath)
-        commit = repo.head.target.hex
+        commit = str(repo.head.target)
         with mock.patch.dict(
             "pagure.config.config",
             {"ARCHIVE_FOLDER": os.path.join(self.path, "archives")},
@@ -386,7 +386,7 @@ class PagureFlaskUiArchivesTest(tests.Mo
         disk cache."""
         repopath = os.path.join(self.path, "repos", "test.git")
         repo = pygit2.Repository(repopath)
-        commit = repo.head.target.hex
+        commit = str(repo.head.target)
         with mock.patch.dict(
             "pagure.config.config",
             {"ARCHIVE_FOLDER": os.path.join(self.path, "archives")},
--- a/tests/test_pagure_flask_ui_fork.py
+++ b/tests/test_pagure_flask_ui_fork.py
@@ -95,7 +95,7 @@ def set_up_git_repo(
 
     try:
         com = repo.revparse_single("HEAD")
-        prev_commit = [com.oid.hex]
+        prev_commit = [str(com.id)]
     except:
         prev_commit = []
 
@@ -145,7 +145,7 @@ def set_up_git_repo(
             # binary string representing the tree object ID
             tree,
             # list of binary strings representing parents of the new commit
-            [first_commit.oid.hex],
+            [str(first_commit.id)],
         )
         refname = "refs/heads/master:refs/heads/master"
         ori_remote = clone_repo.remotes[0]
@@ -169,7 +169,7 @@ def set_up_git_repo(
             # binary string representing the tree object ID
             tree,
             # list of binary strings representing parents of the new commit
-            [first_commit.oid.hex],
+            [str(first_commit.id)],
         )
         refname = "refs/heads/master:refs/heads/master"
         ori_remote = clone_repo.remotes[0]
@@ -204,7 +204,7 @@ def set_up_git_repo(
             committer,
             "A commit on branch %s\n\nMore information" % branch_from,
             tree,
-            [first_commit.oid.hex],
+            [str(first_commit.id)],
         )
         refname = "refs/heads/%s" % (branch_from)
         ori_remote = repo.remotes[0]
@@ -551,7 +551,7 @@ class PagureFlaskForktests(tests.Modelte
         clone_repo.index.write()
 
         com = clone_repo.revparse_single("HEAD")
-        prev_commit = [com.oid.hex]
+        prev_commit = [str(com.id)]
 
         # Commits the files added
         tree = clone_repo.index.write_tree()
@@ -5413,7 +5413,7 @@ More information</textarea>
             parents = []
             try:
                 last_commit = clone_repo.revparse_single("HEAD")
-                parents = [last_commit.oid.hex]
+                parents = [str(last_commit.id)]
             except KeyError:
                 pass
 
@@ -5470,7 +5470,7 @@ More information</textarea>
             # binary string representing the tree object ID
             tree,
             # list of binary strings representing parents of the new commit
-            [last_commit.oid.hex],
+            [str(last_commit.id)],
         )
 
         # Push to the fork repo
@@ -7234,7 +7234,7 @@ More information</textarea>
             # binary string representing the tree object ID
             tree,
             # list of binary strings representing parents of the new commit
-            [last_commit.oid.hex],
+            [str(last_commit.id)],
         )
 
         # Second commit
@@ -7256,7 +7256,7 @@ More information</textarea>
             # binary string representing the tree object ID
             tree,
             # list of binary strings representing parents of the new commit
-            [last_commit.oid.hex],
+            [str(last_commit.id)],
         )
 
         # Third commit
@@ -7278,7 +7278,7 @@ More information</textarea>
             # binary string representing the tree object ID
             tree,
             # list of binary strings representing parents of the new commit
-            [last_commit.oid.hex],
+            [str(last_commit.id)],
         )
 
         refname = "refs/heads/master:refs/heads/master"
--- a/tests/test_pagure_flask_ui_issue_pr_link.py
+++ b/tests/test_pagure_flask_ui_issue_pr_link.py
@@ -91,7 +91,7 @@ class PagureFlaskPrIssueLinkTest(tests.M
 
         try:
             com = repo.revparse_single("HEAD")
-            prev_commit = [com.oid.hex]
+            prev_commit = [str(com.id)]
         except:
             prev_commit = []
 
--- a/tests/test_pagure_flask_ui_issues_templates.py
+++ b/tests/test_pagure_flask_ui_issues_templates.py
@@ -72,7 +72,7 @@ def create_templates(repopath):
         # binary string representing the tree object ID
         tree,
         # list of binary strings representing parents of the new commit
-        [commit.hex],
+        [str(commit)],
     )
 
     # Create the default.md template
@@ -94,7 +94,7 @@ def create_templates(repopath):
         # binary string representing the tree object ID
         tree,
         # list of binary strings representing parents of the new commit
-        [commit.hex],
+        [str(commit)],
     )
 
 
--- a/tests/test_pagure_flask_ui_no_master_branch.py
+++ b/tests/test_pagure_flask_ui_no_master_branch.py
@@ -65,7 +65,7 @@ class PagureFlaskNoMasterBranchtests(tes
         )
 
         feature_branch = clone_repo.lookup_branch("feature")
-        first_commit = feature_branch.peel().hex
+        first_commit = str(feature_branch.peel().id)
 
         # Second commit
         with open(os.path.join(repopath, ".gitignore"), "w") as stream:
--- a/tests/test_pagure_flask_ui_old_commit.py
+++ b/tests/test_pagure_flask_ui_old_commit.py
@@ -65,11 +65,11 @@ class PagureFlaskRepoOldUrltests(tests.S
         commit = repo.revparse_single("HEAD")
 
         # View first commit
-        output = self.app.get("/test/%s" % commit.oid.hex)
+        output = self.app.get("/test/%s" % str(commit.id))
         self.assertEqual(output.status_code, 302)
 
         output = self.app.get(
-            "/test/%s" % commit.oid.hex, follow_redirects=True
+            "/test/%s" % str(commit.id), follow_redirects=True
         )
         self.assertEqual(output.status_code, 200)
         self.assertTrue(
@@ -83,13 +83,13 @@ class PagureFlaskRepoOldUrltests(tests.S
         )
 
         self.assertTrue(
-            'title="View file as of %s"' % commit.oid.hex[0:6]
+            'title="View file as of %s"' % str(commit.id)[0:6]
             in output.get_data(as_text=True)
         )
 
         # View first commit - with the old URL scheme
         output = self.app.get(
-            "/test/%s" % commit.oid.hex, follow_redirects=True
+            "/test/%s" % str(commit.id), follow_redirects=True
         )
         self.assertEqual(output.status_code, 200)
         self.assertTrue(
@@ -112,7 +112,7 @@ class PagureFlaskRepoOldUrltests(tests.S
 
         # View another commit
         output = self.app.get(
-            "/test/%s" % commit.oid.hex, follow_redirects=True
+            "/test/%s" % str(commit.id), follow_redirects=True
         )
         self.assertEqual(output.status_code, 200)
         self.assertTrue(
@@ -148,13 +148,13 @@ class PagureFlaskRepoOldUrltests(tests.S
 
         # Commit does not exist in anothe repo :)
         output = self.app.get(
-            "/test/%s" % commit.oid.hex, follow_redirects=True
+            "/test/%s" % str(commit.id), follow_redirects=True
         )
         self.assertEqual(output.status_code, 404)
 
         # View commit of fork
         output = self.app.get(
-            "/fork/pingou/test3/%s" % commit.oid.hex, follow_redirects=True
+            "/fork/pingou/test3/%s" % str(commit.id), follow_redirects=True
         )
         self.assertEqual(output.status_code, 200)
         self.assertTrue(
@@ -168,13 +168,13 @@ class PagureFlaskRepoOldUrltests(tests.S
         )
 
         self.assertTrue(
-            'title="View file as of %s"' % commit.oid.hex[0:6]
+            'title="View file as of %s"' % str(commit.id)[0:6]
             in output.get_data(as_text=True)
         )
 
         # View commit of fork - With the old URL scheme
         output = self.app.get(
-            "/fork/pingou/test3/%s" % commit.oid.hex, follow_redirects=True
+            "/fork/pingou/test3/%s" % str(commit.id), follow_redirects=True
         )
         self.assertEqual(output.status_code, 200)
         self.assertTrue(
@@ -189,7 +189,7 @@ class PagureFlaskRepoOldUrltests(tests.S
 
         # Try the old URL scheme with a short hash
         output = self.app.get(
-            "/fork/pingou/test3/%s" % commit.oid.hex[:10],
+            "/fork/pingou/test3/%s" % str(commit.id)[:10],
             follow_redirects=True,
         )
         self.assertEqual(output.status_code, 404)
--- a/tests/test_pagure_flask_ui_remote_pr.py
+++ b/tests/test_pagure_flask_ui_remote_pr.py
@@ -74,7 +74,7 @@ class PagureRemotePRtests(tests.Modeltes
 
         try:
             com = repo.revparse_single("HEAD")
-            prev_commit = [com.oid.hex]
+            prev_commit = [str(com.id)]
         except:
             prev_commit = []
 
@@ -116,7 +116,7 @@ class PagureRemotePRtests(tests.Modeltes
             # binary string representing the tree object ID
             tree,
             # list of binary strings representing parents of the new commit
-            [first_commit.oid.hex],
+            [str(first_commit.id)],
         )
         refname = "refs/heads/master:refs/heads/master"
         ori_remote = clone_repo.remotes[0]
@@ -150,7 +150,7 @@ class PagureRemotePRtests(tests.Modeltes
             committer,
             "A commit on branch %s" % branch_from,
             tree,
-            [first_commit.oid.hex],
+            [str(first_commit.id)],
         )
         refname = "refs/heads/%s" % (branch_from)
         ori_remote = repo.remotes[0]
--- a/tests/test_pagure_flask_ui_repo.py
+++ b/tests/test_pagure_flask_ui_repo.py
@@ -2678,7 +2678,7 @@ class PagureFlaskRepotests(tests.Modelte
         tagger = pygit2.Signature("Alice Doe", "adoe@example.com", 12347, 0)
         repo.create_tag(
             "0.0.1",
-            first_commit.oid.hex,
+            str(first_commit.id),
             pygit2.GIT_OBJ_COMMIT,
             tagger,
             "Release 0.0.1",
@@ -2691,8 +2691,8 @@ class PagureFlaskRepotests(tests.Modelte
         output = self.app.get("/test/commits/0.0.1")
         self.assertEqual(output.status_code, 200)
         output_text = output.get_data(as_text=True)
-        self.assertIn(first_commit.oid.hex, output_text)
-        self.assertNotIn(latest_commit.oid.hex, output_text)
+        self.assertIn(str(first_commit.id), output_text)
+        self.assertNotIn(str(latest_commit.id), output_text)
         self.assertIn("<title>Commits - test - Pagure</title>", output_text)
         self.assertEqual(output_text.count('<span id="commit-actions">'), 1)
 
@@ -2713,7 +2713,7 @@ class PagureFlaskRepotests(tests.Modelte
             repo_obj, commit.tree, ["sources"], bail_on_tree=True
         )
 
-        output = self.app.get("/test/commits/%s" % content.oid.hex)
+        output = self.app.get("/test/commits/%s" % str(content.id))
         self.assertEqual(output.status_code, 404)
         output_text = output.get_data(as_text=True)
         self.assertIn("Invalid branch/identifier provided", output_text)
@@ -2731,7 +2731,7 @@ class PagureFlaskRepotests(tests.Modelte
         tagger = pygit2.Signature("Alice Doe", "adoe@example.com", 12347, 0)
         repo.create_tag(
             "0.0.1",
-            first_commit.oid.hex,
+            str(first_commit.id),
             pygit2.GIT_OBJ_COMMIT,
             tagger,
             "Release 0.0.1",
@@ -2741,8 +2741,8 @@ class PagureFlaskRepotests(tests.Modelte
         repo = pygit2.Repository(os.path.join(self.path, "repos", "test.git"))
         project = pagure.lib.query.get_authorized_project(self.session, "test")
         tags = pagure.lib.git.get_git_tags_objects(project)
-        tag_id = tags[0]["object"].oid
-        commit_id = tags[0]["object"].peel(pygit2.Commit).hex
+        tag_id = tags[0]["object"].id
+        commit_id = str(tags[0]["object"].peel(pygit2.Commit).id)
 
         output = self.app.get("/test/c/%s" % tag_id)
         self.assertEqual(output.status_code, 302)
@@ -2750,7 +2750,7 @@ class PagureFlaskRepotests(tests.Modelte
         output = self.app.get("/test/c/%s" % tag_id, follow_redirects=True)
         self.assertEqual(output.status_code, 200)
         output_text = output.get_data(as_text=True)
-        self.assertIn(first_commit.oid.hex, output_text)
+        self.assertIn(str(first_commit.id), output_text)
         self.assertIn(
             "<title>Commit - test - %s - Pagure</title>" % commit_id,
             output_text,
@@ -2762,17 +2762,17 @@ class PagureFlaskRepotests(tests.Modelte
         # First two commits comparison
         def compare_first_two(c1, c2):
             # View commits comparison
-            output = self.app.get("/test/c/%s..%s" % (c2.oid.hex, c1.oid.hex))
+            output = self.app.get("/test/c/%s..%s" % (str(c2.id), str(c1.id)))
             self.assertEqual(output.status_code, 200)
             output_text = output.get_data(as_text=True)
             self.assertIn(
                 "<title>Diff from %s to %s - test\n - Pagure</title>"
-                % (c2.oid.hex, c1.oid.hex),
+                % (str(c2.id), str(c1.id)),
                 output_text,
             )
             self.assertIn(
                 '        <span class="badge-light border border-secondary badge">%s</span>\n        ..\n        <span class="badge-light border border-secondary badge">%s</span>\n'
-                % (c2.oid.hex, c1.oid.hex),
+                % (str(c2.id), str(c1.id)),
                 output_text,
             )
             self.assertNotIn('id="show_hidden_commits"', output_text)
@@ -2781,18 +2781,18 @@ class PagureFlaskRepotests(tests.Modelte
                 output_text,
             )
             # View inverse commits comparison
-            output = self.app.get("/test/c/%s..%s" % (c1.oid.hex, c2.oid.hex))
+            output = self.app.get("/test/c/%s..%s" % (str(c1.id), str(c2.id)))
             self.assertEqual(output.status_code, 200)
             output_text = output.get_data(as_text=True)
             self.assertIn(
                 "<title>Diff from %s to %s - test\n - Pagure</title>"
-                % (c1.oid.hex, c2.oid.hex),
+                % (str(c1.id), str(c2.id)),
                 output_text,
             )
             self.assertNotIn('id="show_hidden_commits"', output_text)
             self.assertIn(
                 '        <span class="badge-light border border-secondary badge">%s</span>\n        ..\n        <span class="badge-light border border-secondary badge">%s</span>\n'
-                % (c1.oid.hex, c2.oid.hex),
+                % (str(c1.id), str(c2.id)),
                 output_text,
             )
             self.assertIn(
@@ -2802,17 +2802,17 @@ class PagureFlaskRepotests(tests.Modelte
 
         def compare_all(c1, c3):
             # View commits comparison
-            output = self.app.get("/test/c/%s..%s" % (c1.oid.hex, c3.oid.hex))
+            output = self.app.get("/test/c/%s..%s" % (str(c1.id), str(c3.id)))
             self.assertEqual(output.status_code, 200)
             output_text = output.get_data(as_text=True)
             self.assertIn(
                 "<title>Diff from %s to %s - test\n - Pagure</title>"
-                % (c1.oid.hex, c3.oid.hex),
+                % (str(c1.id), str(c3.id)),
                 output_text,
             )
             self.assertIn(
                 '        <span class="badge-light border border-secondary badge">%s</span>\n        ..\n        <span class="badge-light border border-secondary badge">%s</span>\n'
-                % (c1.oid.hex, c3.oid.hex),
+                % (str(c1.id), str(c3.id)),
                 output_text,
             )
             self.assertIn(
@@ -2836,17 +2836,17 @@ class PagureFlaskRepotests(tests.Modelte
             )
 
             # View inverse commits comparison
-            output = self.app.get("/test/c/%s..%s" % (c3.oid.hex, c1.oid.hex))
+            output = self.app.get("/test/c/%s..%s" % (str(c3.id), str(c1.id)))
             self.assertEqual(output.status_code, 200)
             output_text = output.get_data(as_text=True)
             self.assertIn(
                 "<title>Diff from %s to %s - test\n - Pagure</title>"
-                % (c3.oid.hex, c1.oid.hex),
+                % (str(c3.id), str(c1.id)),
                 output_text,
             )
             self.assertIn(
                 '        <span class="badge-light border border-secondary badge">%s</span>\n        ..\n        <span class="badge-light border border-secondary badge">%s</span>\n'
-                % (c3.oid.hex, c1.oid.hex),
+                % (str(c3.id), str(c1.id)),
                 output_text,
             )
             self.assertIn(
@@ -2871,13 +2871,13 @@ class PagureFlaskRepotests(tests.Modelte
             # View comparison of commits with symlink
             # we only test that the patch itself renders correctly,
             # the rest of the logic is already tested in the other functions
-            output = self.app.get("/test/c/%s..%s" % (c3.oid.hex, c4.oid.hex))
+            output = self.app.get("/test/c/%s..%s" % (str(c3.id), str(c4.id)))
             self.assertEqual(output.status_code, 200)
             output_text = output.get_data(as_text=True)
             print(output_text)
             self.assertIn(
                 "<title>Diff from %s to %s - test\n - Pagure</title>"
-                % (c3.oid.hex, c4.oid.hex),
+                % (str(c3.id), str(c4.id)),
                 output_text,
             )
             self.assertIn(
@@ -3011,7 +3011,7 @@ class PagureFlaskRepotests(tests.Modelte
         repo = pygit2.Repository(os.path.join(self.path, "repos", "test.git"))
         commit = repo.revparse_single("HEAD")
 
-        output = self.app.get("/test/blob/%s/f/test.jpg" % commit.oid.hex)
+        output = self.app.get("/test/blob/%s/f/test.jpg" % str(commit.id))
         self.assertEqual(output.status_code, 200)
         self.assertNotIn(b"<html", output.data)
 
@@ -3216,7 +3216,7 @@ class PagureFlaskRepotests(tests.Modelte
         repo = pygit2.Repository(os.path.join(self.path, "repos", "test.git"))
         commit = repo.revparse_single("HEAD")
 
-        output = self.app.get("/test/raw/%s/f/test.jpg" % commit.oid.hex)
+        output = self.app.get("/test/raw/%s/f/test.jpg" % str(commit.id))
         self.assertEqual(output.status_code, 200)
         output_text = output.get_data()
         self.assertTrue(output_text.startswith(b"\x00\x00\x01\x00"))
@@ -3260,7 +3260,7 @@ class PagureFlaskRepotests(tests.Modelte
             output_text.startswith("diff --git a/test_binary b/test_binary\n")
         )
 
-        output = self.app.get("/test/raw/%s" % commit.oid.hex)
+        output = self.app.get("/test/raw/%s" % str(commit.id))
         self.assertEqual(output.status_code, 200)
         output_text = output.get_data(as_text=True)
         self.assertTrue(
@@ -3322,7 +3322,7 @@ class PagureFlaskRepotests(tests.Modelte
         commit = repo.revparse_single("HEAD")
 
         # View first commit
-        output = self.app.get("/test/c/%s" % commit.oid.hex)
+        output = self.app.get("/test/c/%s" % str(commit.id))
         self.assertEqual(output.status_code, 200)
         output_text = output.get_data(as_text=True)
         self.assertIn("#commit-overview-collapse", output_text)
@@ -3336,7 +3336,7 @@ class PagureFlaskRepotests(tests.Modelte
 
         # View first commit - with the old URL scheme disabled - default
         output = self.app.get(
-            "/test/%s" % commit.oid.hex, follow_redirects=True
+            "/test/%s" % str(commit.id), follow_redirects=True
         )
         self.assertEqual(output.status_code, 404)
         output_text = output.get_data(as_text=True)
@@ -3359,7 +3359,7 @@ class PagureFlaskRepotests(tests.Modelte
         commit_sl = repo.revparse_single("HEAD")
 
         # View another commit
-        output = self.app.get("/test/c/%s" % commit.oid.hex)
+        output = self.app.get("/test/c/%s" % str(commit.id))
         self.assertEqual(output.status_code, 200)
         output_text = output.get_data(as_text=True)
         self.assertIn("#commit-overview-collapse", output_text)
@@ -3367,7 +3367,7 @@ class PagureFlaskRepotests(tests.Modelte
         self.assertIn("Committed by Cecil Committer", output_text)
 
         # Make sure that diff containing symlink displays the header correctly
-        output = self.app.get("/test/c/%s" % commit_sl.oid.hex)
+        output = self.app.get("/test/c/%s" % str(commit_sl.id))
         self.assertEqual(output.status_code, 200)
         output_text = output.get_data(as_text=True)
         # check the link to the file
@@ -3377,7 +3377,7 @@ class PagureFlaskRepotests(tests.Modelte
         self.assertIn(">+1</span>", output_text)
 
         # View the commit when branch name is provided
-        output = self.app.get("/test/c/%s?branch=master" % commit.oid.hex)
+        output = self.app.get("/test/c/%s?branch=master" % str(commit.id))
         self.assertEqual(output.status_code, 200)
         output_text = output.get_data(as_text=True)
         self.assertIn(
@@ -3389,7 +3389,7 @@ class PagureFlaskRepotests(tests.Modelte
         )
 
         # View the commit when branch name is wrong, show the commit
-        output = self.app.get("/test/c/%s?branch=abcxyz" % commit.oid.hex)
+        output = self.app.get("/test/c/%s?branch=abcxyz" % str(commit.id))
         self.assertEqual(output.status_code, 200)
         output_text = output.get_data(as_text=True)
         self.assertIn(
@@ -3422,11 +3422,11 @@ class PagureFlaskRepotests(tests.Modelte
         commit = repo.revparse_single("HEAD")
 
         # Commit does not exist in anothe repo :)
-        output = self.app.get("/test/c/%s" % commit.oid.hex)
+        output = self.app.get("/test/c/%s" % str(commit.id))
         self.assertEqual(output.status_code, 404)
 
         # View commit of fork
-        output = self.app.get("/fork/pingou/test3/c/%s" % commit.oid.hex)
+        output = self.app.get("/fork/pingou/test3/c/%s" % str(commit.id))
         self.assertEqual(output.status_code, 200)
         output_text = output.get_data(as_text=True)
         self.assertIn("#commit-overview-collapse", output_text)
@@ -3435,7 +3435,7 @@ class PagureFlaskRepotests(tests.Modelte
 
         # Try the old URL scheme with a short hash
         output = self.app.get(
-            "/fork/pingou/test3/%s" % commit.oid.hex[:10],
+            "/fork/pingou/test3/%s" % str(commit.id)[:10],
             follow_redirects=True,
         )
         self.assertEqual(output.status_code, 404)
@@ -3444,7 +3444,7 @@ class PagureFlaskRepotests(tests.Modelte
 
         # View the commit of the fork when branch name is provided
         output = self.app.get(
-            "/fork/pingou/test3/c/%s?branch=master" % commit.oid.hex
+            "/fork/pingou/test3/c/%s?branch=master" % str(commit.id)
         )
         self.assertEqual(output.status_code, 200)
         output_text = output.get_data(as_text=True)
@@ -3459,7 +3459,7 @@ class PagureFlaskRepotests(tests.Modelte
 
         # View the commit of the fork when branch name is wrong
         output = self.app.get(
-            "/fork/pingou/test3/c/%s?branch=abcxyz" % commit.oid.hex
+            "/fork/pingou/test3/c/%s?branch=abcxyz" % str(commit.id)
         )
         self.assertEqual(output.status_code, 200)
         output_text = output.get_data(as_text=True)
@@ -3498,7 +3498,7 @@ class PagureFlaskRepotests(tests.Modelte
         commit = repo.revparse_single("HEAD")
 
         # View first commit
-        output = self.app.get("/test/c/%s" % commit.oid.hex)
+        output = self.app.get("/test/c/%s" % str(commit.id))
         self.assertEqual(output.status_code, 200)
         output_text = output.get_data(as_text=True)
         self.assertIn("#commit-overview-collapse", output_text)
@@ -3542,7 +3542,7 @@ class PagureFlaskRepotests(tests.Modelte
         commit = repo.revparse_single("HEAD")
 
         # View first commit
-        output = self.app.get("/test/c/%s" % commit.oid.hex)
+        output = self.app.get("/test/c/%s" % str(commit.id))
         self.assertEqual(output.status_code, 200)
         output_text = output.get_data(as_text=True)
         self.assertIn("#commit-overview-collapse", output_text)
@@ -3582,7 +3582,7 @@ class PagureFlaskRepotests(tests.Modelte
         commit = repo.revparse_single("HEAD")
 
         # View first commit
-        output = self.app.get("/test/c/%s.patch" % commit.oid.hex)
+        output = self.app.get("/test/c/%s.patch" % str(commit.id))
         self.assertEqual(output.status_code, 200)
         output_text = output.get_data(as_text=True)
         self.assertIn(
@@ -3622,7 +3622,7 @@ index 0000000..fb7093d
         commit = repo.revparse_single("HEAD")
 
         # View another commit
-        output = self.app.get("/test/c/%s.patch" % commit.oid.hex)
+        output = self.app.get("/test/c/%s.patch" % str(commit.id))
         self.assertEqual(output.status_code, 200)
         output_text = output.get_data(as_text=True)
         self.assertIn(
@@ -3666,11 +3666,11 @@ index 0000000..11980b1
         commit = repo.revparse_single("HEAD")
 
         # Commit does not exist in anothe repo :)
-        output = self.app.get("/test/c/%s.patch" % commit.oid.hex)
+        output = self.app.get("/test/c/%s.patch" % str(commit.id))
         self.assertEqual(output.status_code, 404)
 
         # View commit of fork
-        output = self.app.get("/fork/pingou/test3/c/%s.patch" % commit.oid.hex)
+        output = self.app.get("/fork/pingou/test3/c/%s.patch" % str(commit.id))
         self.assertEqual(output.status_code, 200)
         output_text = output.get_data(as_text=True)
         self.assertIn(
@@ -3724,7 +3724,7 @@ index 0000000..fb7093d
         commit = repo.revparse_single("HEAD")
 
         # View first commit
-        output = self.app.get("/test/c/%s.diff" % commit.oid.hex)
+        output = self.app.get("/test/c/%s.diff" % str(commit.id))
         self.assertEqual(output.status_code, 200)
         output_text = output.get_data(as_text=True)
         self.assertEqual(
@@ -3790,7 +3790,7 @@ index 0000000..fb7093d
         commit = repo.revparse_single("HEAD")
 
         # View first commit
-        output = self.app.get("/test/tree/%s" % commit.oid.hex)
+        output = self.app.get("/test/tree/%s" % str(commit.id))
         self.assertEqual(output.status_code, 200)
         output_text = output.get_data(as_text=True)
         self.assertIn("<title>Tree - test - Pagure</title>", output_text)
@@ -5126,7 +5126,7 @@ index 0000000..fb7093d
         tagger = pygit2.Signature("Alice Doe", "adoe@example.com", 12347, 0)
         repo.create_tag(
             "0.0.1",
-            first_commit.oid.hex,
+            str(first_commit.id),
             pygit2.GIT_OBJ_COMMIT,
             tagger,
             "Release 0.0.1",
--- a/tests/test_pagure_flask_ui_repo_flag_commit.py
+++ b/tests/test_pagure_flask_ui_repo_flag_commit.py
@@ -44,10 +44,10 @@ class ViewCommitFlagtests(tests.SimplePa
         """ Test the view_commit endpoint. """
 
         # View first commit
-        output = self.app.get("/test/c/%s" % self.commit.oid.hex)
+        output = self.app.get("/test/c/%s" % str(self.commit.id))
         self.assertEqual(output.status_code, 200)
         self.assertIn(
-            "<title>Commit - test - %s - Pagure</title>" % self.commit.oid.hex,
+            "<title>Commit - test - %s - Pagure</title>" % str(self.commit.id),
             output.get_data(as_text=True),
         )
         self.assertIn(
@@ -65,7 +65,7 @@ class ViewCommitFlagtests(tests.SimplePa
         msg = pagure.lib.query.add_commit_flag(
             session=self.session,
             repo=repo,
-            commit_hash=self.commit.oid.hex,
+            commit_hash=str(self.commit.id),
             username="simple-koji-ci",
             status="pending",
             percent=None,
@@ -79,11 +79,11 @@ class ViewCommitFlagtests(tests.SimplePa
         self.assertEqual(msg, ("Flag added", "uid"))
 
         # View first commit
-        output = self.app.get("/test/c/%s" % self.commit.oid.hex)
+        output = self.app.get("/test/c/%s" % str(self.commit.id))
         self.assertEqual(output.status_code, 200)
         output_text = output.get_data(as_text=True)
         self.assertIn(
-            "<title>Commit - test - %s - Pagure</title>" % self.commit.oid.hex,
+            "<title>Commit - test - %s - Pagure</title>" % str(self.commit.id),
             output_text,
         )
         self.assertIn("#commit-overview-collapse", output_text)
@@ -110,7 +110,7 @@ class ViewCommitFlagtests(tests.SimplePa
         msg = pagure.lib.query.add_commit_flag(
             session=self.session,
             repo=repo,
-            commit_hash=self.commit.oid.hex,
+            commit_hash=str(self.commit.id),
             username="simple-koji-ci",
             status="success",
             percent=100,
@@ -124,11 +124,11 @@ class ViewCommitFlagtests(tests.SimplePa
         self.assertEqual(msg, ("Flag added", "uid"))
 
         # View first commit
-        output = self.app.get("/test/c/%s" % self.commit.oid.hex)
+        output = self.app.get("/test/c/%s" % str(self.commit.id))
         self.assertEqual(output.status_code, 200)
         output_text = output.get_data(as_text=True)
         self.assertIn(
-            "<title>Commit - test - %s - Pagure</title>" % self.commit.oid.hex,
+            "<title>Commit - test - %s - Pagure</title>" % str(self.commit.id),
             output_text,
         )
         self.assertIn("#commit-overview-collapse", output_text)
@@ -155,7 +155,7 @@ class ViewCommitFlagtests(tests.SimplePa
         msg = pagure.lib.query.add_commit_flag(
             session=self.session,
             repo=repo,
-            commit_hash=self.commit.oid.hex,
+            commit_hash=str(self.commit.id),
             username="simple-koji-ci",
             status="error",
             percent=None,
@@ -169,11 +169,11 @@ class ViewCommitFlagtests(tests.SimplePa
         self.assertEqual(msg, ("Flag added", "uid"))
 
         # View first commit
-        output = self.app.get("/test/c/%s" % self.commit.oid.hex)
+        output = self.app.get("/test/c/%s" % str(self.commit.id))
         self.assertEqual(output.status_code, 200)
         output_text = output.get_data(as_text=True)
         self.assertIn(
-            "<title>Commit - test - %s - Pagure</title>" % self.commit.oid.hex,
+            "<title>Commit - test - %s - Pagure</title>" % str(self.commit.id),
             output_text,
         )
         self.assertIn("#commit-overview-collapse", output_text)
@@ -200,7 +200,7 @@ class ViewCommitFlagtests(tests.SimplePa
         msg = pagure.lib.query.add_commit_flag(
             session=self.session,
             repo=repo,
-            commit_hash=self.commit.oid.hex,
+            commit_hash=str(self.commit.id),
             username="simple-koji-ci",
             status="failure",
             percent=None,
@@ -214,11 +214,11 @@ class ViewCommitFlagtests(tests.SimplePa
         self.assertEqual(msg, ("Flag added", "uid"))
 
         # View first commit
-        output = self.app.get("/test/c/%s" % self.commit.oid.hex)
+        output = self.app.get("/test/c/%s" % str(self.commit.id))
         self.assertEqual(output.status_code, 200)
         output_text = output.get_data(as_text=True)
         self.assertIn(
-            "<title>Commit - test - %s - Pagure</title>" % self.commit.oid.hex,
+            "<title>Commit - test - %s - Pagure</title>" % str(self.commit.id),
             output_text,
         )
         self.assertIn("#commit-overview-collapse", output_text)
@@ -244,7 +244,7 @@ class ViewCommitFlagtests(tests.SimplePa
         msg = pagure.lib.query.add_commit_flag(
             session=self.session,
             repo=repo,
-            commit_hash=self.commit.oid.hex,
+            commit_hash=str(self.commit.id),
             username="simple-koji-ci",
             status="canceled",
             percent=None,
@@ -258,11 +258,11 @@ class ViewCommitFlagtests(tests.SimplePa
         self.assertEqual(msg, ("Flag added", "uid"))
 
         # View first commit
-        output = self.app.get("/test/c/%s" % self.commit.oid.hex)
+        output = self.app.get("/test/c/%s" % str(self.commit.id))
         self.assertEqual(output.status_code, 200)
         output_text = output.get_data(as_text=True)
         self.assertIn(
-            "<title>Commit - test - %s - Pagure</title>" % self.commit.oid.hex,
+            "<title>Commit - test - %s - Pagure</title>" % str(self.commit.id),
             output_text,
         )
         self.assertIn("#commit-overview-collapse", output_text)
@@ -297,7 +297,7 @@ class ViewCommitFlagtests(tests.SimplePa
         msg = pagure.lib.query.add_commit_flag(
             session=self.session,
             repo=repo,
-            commit_hash=self.commit.oid.hex,
+            commit_hash=str(self.commit.id),
             username="simple-koji-ci",
             status="status1",
             percent=None,
@@ -311,11 +311,11 @@ class ViewCommitFlagtests(tests.SimplePa
         self.assertEqual(msg, ("Flag added", "uid"))
 
         # View first commit
-        output = self.app.get("/test/c/%s" % self.commit.oid.hex)
+        output = self.app.get("/test/c/%s" % str(self.commit.id))
         self.assertEqual(output.status_code, 200)
         output_text = output.get_data(as_text=True)
         self.assertIn(
-            "<title>Commit - test - %s - Pagure</title>" % self.commit.oid.hex,
+            "<title>Commit - test - %s - Pagure</title>" % str(self.commit.id),
             output_text,
         )
         self.assertIn("#commit-overview-collapse", output_text)
--- a/tests/test_pagure_flask_ui_repo_slash_name.py
+++ b/tests/test_pagure_flask_ui_repo_slash_name.py
@@ -238,7 +238,7 @@ class PagureFlaskSlashInNametests(tests.
         gitrepo = os.path.join(self.path, "repos", "forks/test.git")
         repo = pygit2.Repository(gitrepo)
         master_branch = repo.lookup_branch("master")
-        first_commit = master_branch.peel().hex
+        first_commit = str(master_branch.peel().id)
 
         output = self.app.get("/forks/test/commits")
         self.assertEqual(output.status_code, 200)
--- a/tests/test_pagure_flask_ui_repo_view_blame.py
+++ b/tests/test_pagure_flask_ui_repo_view_blame.py
@@ -135,7 +135,7 @@ class PagureFlaskRepoViewBlameFiletests(
             os.path.join(self.path, "repos", "test.git")
         )
         commit = repo_obj[repo_obj.head.target]
-        parent = commit.parents[0].oid.hex
+        parent = str(commit.parents[0].id)
 
         output = self.app.get(
             "/test/blame/sources?identifier={}".format(parent)
@@ -182,7 +182,7 @@ class PagureFlaskRepoViewBlameFiletests(
             os.path.join(self.path, "repos", "test.git")
         )
         commit = repo_obj[repo_obj.head.target]
-        parent = commit.parents[0].oid.hex
+        parent = str(commit.parents[0].id)
         tagger = pygit2.Signature("Alice Doe", "adoe@example.com", 12347, 0)
         repo_obj.create_tag(
             "v1.0", parent, pygit2.GIT_OBJ_COMMIT, tagger, "Release v1.0"
@@ -217,7 +217,7 @@ class PagureFlaskRepoViewBlameFiletests(
         )
 
         output = self.app.get(
-            "/test/blame/sources?identifier=%s" % content.oid.hex
+            "/test/blame/sources?identifier=%s" % str(content.id)
         )
         self.assertEqual(output.status_code, 404)
         output_text = output.get_data(as_text=True)
--- a/tests/test_pagure_flask_ui_repo_view_file.py
+++ b/tests/test_pagure_flask_ui_repo_view_file.py
@@ -144,7 +144,7 @@ class PagureFlaskRepoViewFiletests(Local
         repo = pygit2.Repository(os.path.join(self.path, "repos", "test.git"))
         commit = repo.revparse_single("HEAD")
 
-        output = self.app.get("/test/blob/%s/f/test.jpg" % commit.oid.hex)
+        output = self.app.get("/test/blob/%s/f/test.jpg" % str(commit.id))
         self.assertEqual(output.status_code, 200)
         self.assertNotIn(b"<html", output.data)
 
--- a/tests/test_pagure_flask_ui_repo_view_history.py
+++ b/tests/test_pagure_flask_ui_repo_view_history.py
@@ -113,7 +113,7 @@ class PagureFlaskRepoViewHistoryFiletest
             os.path.join(self.path, "repos", "test.git")
         )
         commit = repo_obj[repo_obj.head.target]
-        parent = commit.parents[0].oid.hex
+        parent = str(commit.parents[0].id)
 
         output = self.app.get(
             "/test/history/sources?identifier={}".format(parent)
@@ -140,7 +140,7 @@ class PagureFlaskRepoViewHistoryFiletest
             os.path.join(self.path, "repos", "test.git")
         )
         commit = repo_obj[repo_obj.head.target]
-        parent = commit.parents[0].oid.hex
+        parent = str(commit.parents[0].id)
         tagger = pygit2.Signature("Alice Doe", "adoe@example.com", 12347, 0)
         repo_obj.create_tag(
             "v1.0", parent, pygit2.GIT_OBJ_COMMIT, tagger, "Release v1.0"
--- a/tests/test_pagure_flask_ui_slash_branch_name.py
+++ b/tests/test_pagure_flask_ui_slash_branch_name.py
@@ -68,7 +68,7 @@ class PagureFlaskSlashInBranchtests(test
         PagureRepo.push(ori_remote, refname)
 
         master_branch = clone_repo.lookup_branch("master")
-        first_commit = master_branch.peel().hex
+        first_commit = str(master_branch.peel().id)
 
         # Second commit
         with open(os.path.join(repopath, ".gitignore"), "w") as stream:
--- a/tests/test_pagure_lib.py
+++ b/tests/test_pagure_lib.py
@@ -2384,7 +2384,7 @@ class PagureLibtests(tests.Modeltests):
 
         # Add a tag
         tagged_commit = (
-            pygit2.Repository(gitrepo).revparse_single("master").hex
+            str(pygit2.Repository(gitrepo).revparse_single("master").id)
         )
         tag_sha = tests.add_tag_git_repo(
             gitrepo, "1.2.3", tagged_commit, "release 1.2.3"
@@ -2414,7 +2414,7 @@ class PagureLibtests(tests.Modeltests):
         # Check the tag is there
         fork_obj = pygit2.Repository(project.repopath("main"))
         tag = fork_obj.get(tag_sha)
-        self.assertEqual(fork_obj[tag.target].hex, tagged_commit)
+        self.assertEqual(str(fork_obj[tag.target].id), tagged_commit)
         self.assertEqual(tag.message, "release 1.2.3")
 
     def test_fork_project_namespaced(self):
--- a/tests/test_pagure_lib_git.py
+++ b/tests/test_pagure_lib_git.py
@@ -3174,9 +3174,9 @@ index 0000000..60f7480
         shutil.rmtree(newgitrepo)
 
         output4 = pagure.lib.git.get_revs_between(
-            "0", branch_commit.oid.hex, gitrepo, "refs/heads/feature"
+            "0", str(branch_commit.id), gitrepo, "refs/heads/feature"
         )
-        self.assertEqual(output4, [branch_commit.oid.hex])
+        self.assertEqual(output4, [str(branch_commit.id)])
 
     def test_get_author(self):
         """ Test the get_author method of pagure.lib.git. """
@@ -3629,18 +3629,18 @@ index 0000000..60f7480
 
         # make sure that creating works the first time
         pagure.lib.git.update_pull_ref(fake_pr, fork)
-        oldhex = fork.references["refs/heads/master"].peel().hex
+        oldhex = str(fork.references["refs/heads/master"].peel().id)
         self.assertEqual(
-            orig.references["refs/pull/6/head"].peel().hex, oldhex
+            str(orig.references["refs/pull/6/head"].peel().id), oldhex
         )
 
         # make sure that updating works correctly
         tests.add_content_git_repo(projects[1], append="foobar")
-        newhex = fork.references["refs/heads/master"].peel().hex
+        newhex = str(fork.references["refs/heads/master"].peel().id)
         self.assertNotEqual(oldhex, newhex)
         pagure.lib.git.update_pull_ref(fake_pr, fork)
         self.assertEqual(
-            orig.references["refs/pull/6/head"].peel().hex, newhex
+            str(orig.references["refs/pull/6/head"].peel().id), newhex
         )
 
         # make sure the function works fine even if there's a leftover
@@ -3649,11 +3649,11 @@ index 0000000..60f7480
             pagure.lib.git.update_pull_ref(fake_pr, fork)
         self.assertIsNotNone(fork.remotes["pingou_1234567"])
         tests.add_content_git_repo(projects[1], append="foobarbaz")
-        newesthex = fork.references["refs/heads/master"].peel().hex
+        newesthex = str(fork.references["refs/heads/master"].peel().id)
         self.assertNotEqual(newhex, newesthex)
         pagure.lib.git.update_pull_ref(fake_pr, fork)
         self.assertEqual(
-            orig.references["refs/pull/6/head"].peel().hex, newesthex
+            str(orig.references["refs/pull/6/head"].peel().id), newesthex
         )
 
 
@@ -3713,7 +3713,7 @@ class PagureLibGitCommitToPatchtests(tes
             # binary string representing the tree object ID
             tree,
             # list of binary strings representing parents of the new commit
-            [self.first_commit.oid.hex],
+            [str(self.first_commit.id)],
         )
 
         self.second_commit = repo.revparse_single("HEAD")
@@ -3727,7 +3727,7 @@ class PagureLibGitCommitToPatchtests(tes
             # binary string representing the tree object ID
             tree,
             # list of binary strings representing parents of the new commit
-            [self.second_commit.oid.hex],
+            [str(self.second_commit.id)],
         )
 
         self.third_commit = repo.revparse_single("HEAD")
--- a/tests/test_pagure_lib_git_diff_pr.py
+++ b/tests/test_pagure_lib_git_diff_pr.py
@@ -98,7 +98,7 @@ class PagureFlaskForkPrtests(tests.Model
             parents = []
             try:
                 last_commit = clone_repo.revparse_single("HEAD")
-                parents = [last_commit.oid.hex]
+                parents = [str(last_commit.id)]
             except KeyError:
                 pass
 
@@ -151,7 +151,7 @@ class PagureFlaskForkPrtests(tests.Model
                 # binary string representing the tree object ID
                 tree,
                 # list of binary strings representing parents of the new commit
-                [last_commit.oid.hex],
+                [str(last_commit.id)],
             )
         # Push to the main repo
         refname = "refs/heads/master:refs/heads/master"
@@ -181,7 +181,7 @@ class PagureFlaskForkPrtests(tests.Model
             # binary string representing the tree object ID
             tree,
             # list of binary strings representing parents of the new commit
-            [last_commit.oid.hex],
+            [str(last_commit.id)],
         )
 
         with open(os.path.join(repopath, "sources"), "w") as stream:
@@ -201,7 +201,7 @@ class PagureFlaskForkPrtests(tests.Model
             # binary string representing the tree object ID
             tree,
             # list of binary strings representing parents of the new commit
-            [last_commit.hex],
+            [str(last_commit)],
         )
 
         # Push to the fork repo
@@ -320,7 +320,7 @@ class PagureFlaskForkPrtests(tests.Model
 
         pr_ref = repo.lookup_reference("refs/pull/1/head")
         commit = pr_ref.peel()
-        self.assertEqual(commit.oid.hex, diff_commits[0].oid.hex)
+        self.assertEqual(str(commit.id), str(diff_commits[0].id))
 
     @patch.dict(
         "pagure.config.config", {"FEDORA_MESSAGING_NOTIFICATIONS": True}
@@ -359,7 +359,7 @@ class PagureFlaskForkPrtests(tests.Model
 
         pr_ref = repo.lookup_reference("refs/pull/1/head")
         commit = pr_ref.peel()
-        self.assertEqual(commit.oid.hex, diff_commits[0].oid.hex)
+        self.assertEqual(str(commit.id), str(diff_commits[0].id))
 
         # Add a new commit on the fork
         repopath = os.path.join(self.path, "pingou_test2")
@@ -386,7 +386,7 @@ class PagureFlaskForkPrtests(tests.Model
             # binary string representing the tree object ID
             tree,
             # list of binary strings representing parents of the new commit
-            [last_commit.oid.hex],
+            [str(last_commit.id)],
         )
 
         # Push to the fork repo
@@ -754,8 +754,8 @@ class PagureFlaskForkPrtests(tests.Model
 
         pr_ref = repo.lookup_reference("refs/pull/1/head")
         commit2 = pr_ref.peel()
-        self.assertEqual(commit2.oid.hex, diff_commits[0].oid.hex)
-        self.assertNotEqual(commit.oid.hex, commit2.oid.hex)
+        self.assertEqual(str(commit2.id), str(diff_commits[0].id))
+        self.assertNotEqual(str(commit.id), str(commit2.id))
 
     def test_two_diff_pull_request_sequentially(self):
         """Test calling pagure.lib.git.diff_pull_request twice returns
@@ -791,7 +791,7 @@ class PagureFlaskForkPrtests(tests.Model
 
         pr_ref = repo.lookup_reference("refs/pull/1/head")
         commit = pr_ref.peel()
-        self.assertEqual(commit.oid.hex, diff_commits[0].oid.hex)
+        self.assertEqual(str(commit.id), str(diff_commits[0].id))
 
         # Run diff_pull_request a second time
 
@@ -804,8 +804,8 @@ class PagureFlaskForkPrtests(tests.Model
         )
         self.assertEqual(len(diff_commits2), 2)
         self.assertEqual(
-            [d.oid.hex for d in diff_commits2],
-            [d.oid.hex for d in diff_commits],
+            [str(d.id) for d in diff_commits2],
+            [str(d.id) for d in diff_commits],
         )
 
         # Check that the PR has its PR refs
@@ -818,9 +818,9 @@ class PagureFlaskForkPrtests(tests.Model
 
         pr_ref = repo.lookup_reference("refs/pull/1/head")
         commit2 = pr_ref.peel()
-        self.assertEqual(commit2.oid.hex, diff_commits[0].oid.hex)
+        self.assertEqual(str(commit2.id), str(diff_commits[0].id))
 
-        self.assertEqual(commit.oid.hex, commit2.oid.hex)
+        self.assertEqual(str(commit.id), str(commit2.id))
 
 
 if __name__ == "__main__":
--- a/tests/test_pagure_lib_git_get_tags_objects.py
+++ b/tests/test_pagure_lib_git_get_tags_objects.py
@@ -45,7 +45,7 @@ def add_repo_tag(git_dir, repo, tags, re
         tagger = pygit2.Signature("Alice Doe", "adoe@example.com", 12347, 0)
         repo.create_tag(
             tag,
-            first_commit.oid.hex,
+            str(first_commit.id),
             pygit2.GIT_OBJ_COMMIT,
             tagger,
             "Release " + tag,
--- a/tests/test_pagure_lib_task_services.py
+++ b/tests/test_pagure_lib_task_services.py
@@ -852,7 +852,7 @@ class PagureLibTaskServicesLoadJsonTicke
         )
 
         commits = [
-            commit.oid.hex
+            str(commit.id)
             for commit in self.repo_obj.walk(
                 self.repo_obj.head.target, pygit2.GIT_SORT_NONE
             )
--- a/tests/test_pagure_send_notification.py
+++ b/tests/test_pagure_send_notification.py
@@ -39,8 +39,8 @@ class PagureHooksDefault(tests.SimplePag
         tests.add_content_git_repo(self.projects[0])
         repo = pygit2.Repository(self.projects[0])
         commit = repo.references["refs/heads/master"].peel()
-        sha = commit.hex
-        oldsha = commit.parents[0].hex
+        sha = str(commit.id)
+        oldsha = str(commit.parents[0].id)
         project = pagure.lib.query.get_authorized_project(self.session, "test")
         return project, sha, oldsha
 
--- a/pagure/templates/commit.html
+++ b/pagure/templates/commit.html
@@ -69,12 +69,12 @@
                 'ui_ns.view_tree', username=username, namespace=repo.namespace,
                 repo=repo.name, identifier=commitid) }}">tree</a>
               {% if commit.parents|length == 1 %}
-              <a class="btn btn-outline-primary btn-sm" title={{commit.parents[0].oid.hex}} href="{{ url_for(
+              <a class="btn btn-outline-primary btn-sm" title={{commit.parents[0].id.__str__()}} href="{{ url_for(
                 'ui_ns.view_commit',
                 repo=repo.name,
                 username=username,
                 namespace=repo.namespace,
-                commitid=commit.parents[0].oid.hex) }}">parent</a>
+                commitid=commit.parents[0].id.__str__()) }}">parent</a>
               {% elif commit.parents|length > 1 %}
               <div class="btn-group" role="group">
                 <button id="parentsDrop" type="button" class="btn btn-secondary btn-sm dropdown-toggle"
@@ -88,8 +88,8 @@
                         repo=repo.name,
                         username=username,
                         namespace=repo.namespace,
-                        commitid=parent.oid.hex)
-                    }}" class="commitid">{{parent.oid.hex}}</a>
+                        commitid=parent.id.__str__())
+                    }}" class="commitid">{{parent.id.__str__()}}</a>
                   {% endfor %}
                 </div>
               </div>
--- a/pagure/templates/commits.html
+++ b/pagure/templates/commits.html
@@ -107,7 +107,7 @@
                           repo=repo.name,
                           username=username,
                           namespace=repo.namespace,
-                          commitid=diff_commit_full.hex) }}"
+                          commitid=diff_commit_full.id.__str__()) }}"
                       class="notblue">
                       <strong>{{ diff_commit_full.message.split('\n')[0] }}</strong>
                     </a>
@@ -126,13 +126,13 @@
                         repo=repo.name,
                         username=username,
                         namespace=repo.namespace,
-                        commitid=diff_commit_full.hex) }}"
+                        commitid=diff_commit_full.id.__str__()) }}"
                         class="btn btn-outline-primary font-weight-bold">
-                        <code>{{ diff_commit_full.hex|short }}</code>
+                        <code>{{ diff_commit_full.id.__str__()|short }}</code>
                       </a>
                       <a class="btn btn-outline-primary font-weight-bold" href="{{ url_for(
                         'ui_ns.view_tree', username=username, namespace=repo.namespace,
-                        repo=repo.name, identifier=diff_commit_full.hex) }}"><span class="fa fa-file-code-o fa-fw"></span></a>
+                        repo=repo.name, identifier=diff_commit_full.id.__str__()) }}"><span class="fa fa-file-code-o fa-fw"></span></a>
                     </div>
                   </div>
                 </div>
@@ -146,10 +146,10 @@
 
 
               {% for commit in last_commits %}
-              <div class="list-group-item {{'ml-4' if diff_commits and commit.oid.hex in diff_commits}}"
-                   id="c_{{ commit.hex }}">
+              <div class="list-group-item {{'ml-4' if diff_commits and commit.id.__str__() in diff_commits}}"
+                   id="c_{{ commit.id.__str__() }}">
                 <div class="row align-items-center">
-                    {% if diff_commits and commit.oid.hex in diff_commits %}
+                    {% if diff_commits and commit.id.__str__() in diff_commits %}
                     <div class="new_commit" title="This commit is not in the main branch of this Repo">
                       <span class="fa fa-arrow-circle-right text-muted pl-1"></span>
                     </div>
@@ -159,7 +159,7 @@
                       repo=repo.name,
                       username=username,
                       namespace=repo.namespace,
-                      commitid=commit.hex, branch=branchname) }}"
+                      commitid=commit.id.__str__(), branch=branchname) }}"
                       class="notblue">
                       <strong>{{ commit.message.split('\n')[0] }}</strong>
                     </a>
@@ -185,13 +185,13 @@
                         repo=repo.name,
                         username=username,
                         namespace=repo.namespace,
-                        commitid=commit.hex, branch=branchname) }}"
-                        class="btn btn-outline-primary font-weight-bold commithash" id="c_{{ commit.hex }}">
-                        <code>{{ commit.hex|short }}</code>
+                        commitid=commit.id.__str__(), branch=branchname) }}"
+                        class="btn btn-outline-primary font-weight-bold commithash" id="c_{{ commit.id.__str__() }}">
+                        <code>{{ commit.id.__str__()|short }}</code>
                       </a>
                       <a class="btn btn-outline-primary font-weight-bold" href="{{ url_for(
                         'ui_ns.view_tree', username=username, namespace=repo.namespace,
-                        repo=repo.name, identifier=commit.hex) }}"><span class="fa fa-file-code-o fa-fw"></span></a>
+                        repo=repo.name, identifier=commit.id.__str__()) }}"><span class="fa fa-file-code-o fa-fw"></span></a>
                     </div>
                   </div>
                 </div>
--- a/pagure/templates/file_history.html
+++ b/pagure/templates/file_history.html
@@ -101,14 +101,14 @@
           <div class="list-group my-2">
               {% for line in log %}
               {% set commit = g.repo_obj[line[0]] %}
-              <div class="list-group-item " id="c_{{ commit.hex }}">
+              <div class="list-group-item " id="c_{{ commit.id.__str__() }}">
                 <div class="row align-items-center">
                   <div class="col">
                     <a href="{{ url_for('ui_ns.view_commit',
                       repo=repo.name,
                       username=username,
                       namespace=repo.namespace,
-                      commitid=commit.hex, branch=branchname) }}"
+                      commitid=commit.id.__str__(), branch=branchname) }}"
                       class="notblue">
                       <strong>{{ commit.message.split('\n')[0] }}</strong>
                     </a>
@@ -134,13 +134,13 @@
                         repo=repo.name,
                         username=username,
                         namespace=repo.namespace,
-                        commitid=commit.hex, branch=branchname) }}"
-                        class="btn btn-outline-primary font-weight-bold commithash" id="c_{{ commit.hex }}">
-                        <code>{{ commit.hex|short }}</code>
+                        commitid=commit.id.__str__(), branch=branchname) }}"
+                        class="btn btn-outline-primary font-weight-bold commithash" id="c_{{ commit.id.__str__() }}">
+                        <code>{{ commit.id.__str__()|short }}</code>
                       </a>
                       <a class="btn btn-outline-primary font-weight-bold" href="{{ url_for(
                         'ui_ns.view_tree', username=username, namespace=repo.namespace,
-                        repo=repo.name, identifier=commit.hex) }}"><span class="fa fa-file-code-o fa-fw"></span></a>
+                        repo=repo.name, identifier=commit.id.__str__()) }}"><span class="fa fa-file-code-o fa-fw"></span></a>
                     </div>
                   </div>
                 </div>
--- a/pagure/templates/releases.html
+++ b/pagure/templates/releases.html
@@ -61,7 +61,7 @@
                     repo=repo.name,
                     username=username,
                     namespace=repo.namespace,
-                    identifier=tag['object'].oid) }}"
+                    identifier=tag['object'].id) }}"
                     class="font-weight-bold">
                     <i class="fa fa-fw fa-tags text-muted"></i> {{tag['tagname']}}
                     </a>
@@ -77,9 +77,9 @@
                     repo=repo.name,
                     username=username,
                     namespace=repo.namespace,
-                    commitid=tag['object'].oid) }}"
+                    commitid=tag['object'].id) }}"
                class="btn btn-outline-secondary disabled">
-              <code class="font-weight-bold">{{ tag['object'].oid | short }}</code>
+              <code class="font-weight-bold">{{ tag['object'].id | short }}</code>
             </a>
             <div class="btn-group">
               <a class="btn btn-outline-primary"
@@ -87,7 +87,7 @@
                        repo=repo.name,
                        username=username,
                        namespace=repo.namespace,
-                       identifier=tag['object'].oid) }}"
+                       identifier=tag['object'].id) }}"
                 title="view code tree for this release">
                 <i class="fa fa-fw fa-file-code-o"></i>
               </a>
--- a/pagure/templates/repo_comparecommits.html
+++ b/pagure/templates/repo_comparecommits.html
@@ -50,10 +50,10 @@
           repo=pull_request.project_from.name,
           username=pull_request.project_from.user.user,
           namespace=repo.namespace,
-          commitid=commit.oid.hex)%}
+          commitid=commit.id.__str__())%}
         {% set tree_link = url_for(
           'ui_ns.view_tree', username=pull_request.project_from.user.user, namespace=repo.namespace,
-          repo=repo.name, identifier=commit.hex) %}
+          repo=repo.name, identifier=commit.id.__str__()) %}
       {% elif pull_request and pull_request.remote %}
         {% set commit_link = None %}
       {% else %}
@@ -61,10 +61,10 @@
                   repo=repo.name,
                   username=username,
                   namespace=repo.namespace,
-                  commitid=commit.oid.hex) %}
+                  commitid=commit.id.__str__()) %}
         {% set tree_link = url_for(
           'ui_ns.view_tree', username=username, namespace=repo.namespace,
-          repo=repo.name, identifier=commit.hex) %}
+          repo=repo.name, identifier=commit.id.__str__()) %}
       {% endif %}
       {% if not loop.last and loop.index == 2 %}
         <div class="list-group-item text-center bg-light" id="show_hidden_commits">
@@ -104,7 +104,7 @@
               <div class="btn-group">
                 <a href="{{ commit_link }}"
                   class="btn btn-outline-primary font-weight-bold {{'disabled' if not commit_link}}">
-                  <code>{{ commit.hex|short }}</code>
+                  <code>{{ commit.id.__str__()|short }}</code>
                 </a>
                 <a class="btn btn-outline-primary font-weight-bold {{'disabled' if not commit_link}}" href="{{tree_link}}"><span class="fa fa-file-code-o fa-fw"></span></a>
               </div>
--- a/pagure/templates/repo_info.html
+++ b/pagure/templates/repo_info.html
@@ -277,10 +277,10 @@
                           repo=repo.name,
                           username=username,
                           namespace=repo.namespace,
-                          commitid=commit.hex, branch=branchname) }}"
+                          commitid=commit.id.__str__(), branch=branchname) }}"
                           class="notblue">
                           <code class="py-1 px-2 font-weight-bold commit_branch">{{ branchname }}</code><code
-                           class="py-1 px-2 font-weight-bold commit_hash">{{ commit.hex|short }}</code>
+                           class="py-1 px-2 font-weight-bold commit_hash">{{ commit.id.__str__()|short }}</code>
                           <span class="font-weight-bold">{{ commit.message.split('\n')[0] }}</span>
                         </a>
                       </div>
--- a/pagure/templates/repo_new_pull_request.html
+++ b/pagure/templates/repo_new_pull_request.html
@@ -265,10 +265,10 @@
                         repo=repo.name,
                         username=username,
                         namespace=repo.namespace,
-                        commitid=commit.oid.hex) %}
+                        commitid=commit.id.__str__()) %}
               {% set tree_link = url_for(
                 'ui_ns.view_tree', username=username, namespace=repo.namespace,
-                repo=repo.name, identifier=commit.hex) %}
+                repo=repo.name, identifier=commit.id.__str__()) %}
 
             <div class="list-group-item">
             <div class="row align-items-center">
@@ -299,7 +299,7 @@
                   <div class="btn-group">
                     <a href="{{ commit_link }}"
                       class="btn btn-outline-primary font-weight-bold {{'disabled' if not commit_link}}">
-                      <code>{{ commit.hex|short }}</code>
+                      <code>{{ commit.id.__str__()|short }}</code>
                     </a>
                     <a class="btn btn-outline-primary font-weight-bold {{'disabled' if not commit_link}}" href="{{tree_link}}"><span class="fa fa-file-code-o fa-fw"></span></a>
                   </div>
--- a/pagure/templates/repo_pull_request.html
+++ b/pagure/templates/repo_pull_request.html
@@ -304,10 +304,10 @@
                 repo=pull_request.project_from.name,
                 username=pull_request.project_from.user.user,
                 namespace=repo.namespace,
-                commitid=commit.oid.hex)%}
+                commitid=commit.id.__str__())%}
               {% set tree_link = url_for(
                 'ui_ns.view_tree', username=pull_request.project_from.user.user, namespace=repo.namespace,
-                repo=repo.name, identifier=commit.hex) %}
+                repo=repo.name, identifier=commit.id.__str__()) %}
             {% elif pull_request.remote %}
               {% set commit_link = None %}
             {% else %}
@@ -315,12 +315,12 @@
                         repo=repo.name,
                         username=repo.user.user if repo.is_fork else None,
                         namespace=repo.namespace,
-                        commitid=commit.oid.hex) %}
+                        commitid=commit.id.__str__()) %}
               {% set tree_link = url_for(
                 'ui_ns.view_tree',
                 username=repo.user.user if repo.is_fork else None,
                 namespace=repo.namespace,
-                repo=repo.name, identifier=commit.hex) %}
+                repo=repo.name, identifier=commit.id.__str__()) %}
             {% endif %}
             <div class="list-group-item">
             <div class="row align-items-center">
@@ -350,9 +350,9 @@
               <div class="col-xs-auto pr-3 text-right">
                   <div class="btn-group">
                     <a href="{{ commit_link }}"
-                      data-commithash="{{ commit.hex }}"
+                      data-commithash="{{ commit.id.__str__() }}"
                       class="btn btn-outline-primary font-weight-bold {{'disabled' if not commit_link}} commithash">
-                      <code>{{ commit.hex|short }}</code>
+                      <code>{{ commit.id.__str__()|short }}</code>
                     </a>
                     <a class="btn btn-outline-primary font-weight-bold {{'disabled' if not commit_link}}" href="{{tree_link}}"><span class="fa fa-file-code-o fa-fw"></span></a>
                   </div>
