| |
@@ -2637,8 +2637,8 @@
|
| |
tagger = pygit2.Signature("Alice Doe", "adoe@example.com", 12347, 0)
|
| |
repo.create_tag(
|
| |
"0.0.1",
|
| |
- first_commit.oid.hex,
|
| |
- pygit2.GIT_OBJ_COMMIT,
|
| |
+ str(first_commit.id),
|
| |
+ pygit2.enums.ObjectType.COMMIT,
|
| |
tagger,
|
| |
"Release 0.0.1",
|
| |
)
|
| |
@@ -2650,8 +2650,8 @@
|
| |
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)
|
| |
|
| |
@@ -2672,7 +2672,7 @@
|
| |
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)
|
| |
@@ -2690,8 +2690,8 @@
|
| |
tagger = pygit2.Signature("Alice Doe", "adoe@example.com", 12347, 0)
|
| |
repo.create_tag(
|
| |
"0.0.1",
|
| |
- first_commit.oid.hex,
|
| |
- pygit2.GIT_OBJ_COMMIT,
|
| |
+ str(first_commit.id),
|
| |
+ pygit2.enums.ObjectType.COMMIT,
|
| |
tagger,
|
| |
"Release 0.0.1",
|
| |
)
|
| |
@@ -2700,8 +2700,8 @@
|
| |
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)
|
| |
@@ -2709,7 +2709,7 @@
|
| |
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,
|
| |
@@ -2721,17 +2721,17 @@
|
| |
# 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)
|
| |
@@ -2740,18 +2740,18 @@
|
| |
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(
|
| |
@@ -2761,17 +2761,17 @@
|
| |
|
| |
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(
|
| |
@@ -2795,17 +2795,17 @@
|
| |
)
|
| |
|
| |
# 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(
|
| |
@@ -2830,13 +2830,13 @@
|
| |
# 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(
|
| |
@@ -2970,7 +2970,7 @@
|
| |
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)
|
| |
|
| |
@@ -3175,7 +3175,7 @@
|
| |
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"))
|
| |
@@ -3219,7 +3219,7 @@
|
| |
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(
|
| |
@@ -3281,7 +3281,7 @@
|
| |
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)
|
| |
@@ -3295,7 +3295,7 @@
|
| |
|
| |
# 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)
|
| |
@@ -3318,7 +3318,7 @@
|
| |
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)
|
| |
@@ -3326,7 +3326,7 @@
|
| |
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
|
| |
@@ -3336,7 +3336,7 @@
|
| |
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(
|
| |
@@ -3348,7 +3348,7 @@
|
| |
)
|
| |
|
| |
# 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(
|
| |
@@ -3381,11 +3381,11 @@
|
| |
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)
|
| |
@@ -3394,7 +3394,7 @@
|
| |
|
| |
# 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)
|
| |
@@ -3403,7 +3403,7 @@
|
| |
|
| |
# 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)
|
| |
@@ -3418,7 +3418,7 @@
|
| |
|
| |
# 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)
|
| |
@@ -3457,7 +3457,7 @@
|
| |
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)
|
| |
@@ -3501,7 +3501,7 @@
|
| |
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)
|
| |
@@ -3541,7 +3541,7 @@
|
| |
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(
|
| |
@@ -3581,7 +3581,7 @@
|
| |
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(
|
| |
@@ -3625,11 +3625,11 @@
|
| |
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(
|
| |
@@ -3683,7 +3683,7 @@
|
| |
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(
|
| |
@@ -3749,7 +3749,7 @@
|
| |
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)
|
| |
@@ -4993,8 +4993,8 @@
|
| |
tagger = pygit2.Signature("Alice Doe", "adoe@example.com", 12347, 0)
|
| |
repo.create_tag(
|
| |
"0.0.1",
|
| |
- first_commit.oid.hex,
|
| |
- pygit2.GIT_OBJ_COMMIT,
|
| |
+ str(first_commit.id),
|
| |
+ pygit2.enums.ObjectType.COMMIT,
|
| |
tagger,
|
| |
"Release 0.0.1",
|
| |
)
|
| |
Test results in Debian unstable (pygit2 1.16.0, full version list near the top, the failures are a lack of openssh-client)
https://salsa.debian.org/debian/pagure/-/jobs/6982015/raw
https://salsa.debian.org/debian/pagure/-/jobs/6982017/raw
The templates use .__str__() because str() does not work there.