Skip to content

Commit 3092037

Browse files
committed
git-to-freshports-xml.py: catch up for pygit2-1.15 changes
From https://github.com/libgit2/pygit2/blob/master/CHANGELOG.md#1150-2024-05-18 under Breaking changes: * Remove deprecated object.hex, use str(object.id) * Remove deprecated object.oid, use object.id This code now requires pygit2>=1.15.0
1 parent 2e9abf7 commit 3092037

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

git-to-freshports/git-to-freshports-xml.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def commit_range(repo: pygit2.Repository, commit_range: str):
122122
start_commit = repo.revparse_single(start_commit_ref)
123123
end_commit = repo.revparse_single(end_commit_ref)
124124

125-
walker = repo.walk(end_commit.oid)
125+
walker = repo.walk(end_commit.id)
126126
walker.simplify_first_parent() # Avoid wandering off to merged branches. Same as 'git log --first-parent'
127127

128128
result = []
@@ -171,7 +171,7 @@ def main():
171171

172172
for order_number, commit in enumerate(commits):
173173
commit: pygit2.Commit
174-
log.info(f"Processing commit '{commit.hex} {commit.message.splitlines()[0]}'")
174+
log.info(f"Processing commit '{str(commit.id)} {commit.message.splitlines()[0]}'")
175175
root = ET.Element('UPDATES', Version=FORMAT_VERSION, Source='git')
176176
update = ET.SubElement(root, 'UPDATE')
177177

@@ -193,11 +193,11 @@ def main():
193193
commit_branches = list(repo.branches.remote.with_commit(commit))
194194
commit_branches_num = len(commit_branches)
195195
if commit_branches_num == 0:
196-
log.error(f"Unable to get branch name for commit {commit.hex}. "
196+
log.error(f"Unable to get branch name for commit {str(commit.id)}. "
197197
f"Make sure that the local tracking branch exists for the remote branch.")
198198
continue
199199
elif commit_branches_num > 1:
200-
log.warning(f"Ambiguity in getting branch name for commit {commit.hex}. Got branches: {commit_branches}."
200+
log.warning(f"Ambiguity in getting branch name for commit {str(commit.id)}. Got branches: {commit_branches}."
201201
f"Using the first one: {commit_branches[0]}")
202202
ET.SubElement(update, 'OS', Repo=config['repo'], Id=config['os'], Branch=commit_branches[0])
203203

@@ -214,7 +214,7 @@ def main():
214214
ET.SubElement(people, 'AUTHOR', AuthorName=f"{commit.author.name}", AuthorEmail=f"{commit.author.email}")
215215

216216
log.debug("Writing commit hash")
217-
ET.SubElement(update, 'COMMIT', Hash=commit.hex, HashShort=commit.short_id,
217+
ET.SubElement(update, 'COMMIT', Hash=str(commit.id), HashShort=commit.short_id,
218218
Subject=commit.message.splitlines()[0], EncodingLoses="false", Repository=config['repo'])
219219

220220
files = ET.SubElement(update, 'FILES')
@@ -244,7 +244,7 @@ def main():
244244

245245
file_name = (f"{commit_datetime.year}.{commit_datetime.month:02d}.{commit_datetime.day:02d}."
246246
f"{commit_datetime.hour:02d}.{commit_datetime.minute:02d}.{commit_datetime.second:02d}."
247-
f"{order_number:06d}.{commit.hex}.xml")
247+
f"{order_number:06d}.{str(commit.id)}.xml")
248248
file_mode = 'wb' if config['force'] else 'xb'
249249
log.debug("Dumping XML")
250250
try:

0 commit comments

Comments
 (0)