Skip to content

Commit 2ea43ed

Browse files
committed
Remove deprecated IndexEntry.hex and deprecate IndexEntry.oid
1 parent 9fe9f22 commit 2ea43ed

File tree

2 files changed

+42
-32
lines changed

2 files changed

+42
-32
lines changed

CHANGELOG.md

Lines changed: 41 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@
2525
- Updated .gitignore
2626
[#1424](https://github.com/libgit2/pygit2/pull/1424)
2727

28+
Breaking changes:
29+
30+
- Remove deprecated `IndexEntry.hex`, use `str(entry.id)` instead of `entry.hex`
31+
32+
Deprecations:
33+
34+
- Deprecate `IndexEntry.oid`, use `entry.id` instead of `entry.oid`
35+
2836
# 1.18.2 (2025-08-16)
2937

3038
- Add support for almost all global options
@@ -325,31 +333,39 @@ Deprecations:
325333

326334
# 1.14.0 (2024-01-26)
327335

328-
- Drop support for Python 3.8
329-
- Add Linux wheels for musl on x86\_64
330-
[#1266](https://github.com/libgit2/pygit2/pull/1266)
331-
- New `Repository.submodules` namespace
332-
[#1250](https://github.com/libgit2/pygit2/pull/1250)
333-
- New `Repository.listall_mergeheads()`, `Repository.message`,
334-
`Repository.raw_message` and `Repository.remove_message()`
335-
[#1261](https://github.com/libgit2/pygit2/pull/1261)
336-
- New `pygit2.enums` supersedes the `GIT_` constants
337-
[#1251](https://github.com/libgit2/pygit2/pull/1251)
338-
- Now `Repository.status()`, `Repository.status_file()`,
339-
`Repository.merge_analysis()`, `DiffFile.flags`, `DiffFile.mode`,
340-
`DiffDelta.flags` and `DiffDelta.status` return enums
341-
[#1263](https://github.com/libgit2/pygit2/pull/1263)
342-
- Now repository\'s `merge()`, `merge_commits()` and `merge_trees()`
343-
take enums/flags for their `favor`, `flags` and `file_flags` arguments.
344-
[#1271](https://github.com/libgit2/pygit2/pull/1271)
345-
[#1272](https://github.com/libgit2/pygit2/pull/1272)
346-
- Fix crash in filter cleanup
347-
[#1259](https://github.com/libgit2/pygit2/pull/1259)
348-
- Documentation fixes
349-
[#1255](https://github.com/libgit2/pygit2/pull/1255)
350-
[#1258](https://github.com/libgit2/pygit2/pull/1258)
351-
[#1268](https://github.com/libgit2/pygit2/pull/1268)
352-
[#1270](https://github.com/libgit2/pygit2/pull/1270)
336+
- Drop support for Python 3.8
337+
338+
- Add Linux wheels for musl on x86\_64
339+
[#1266](https://github.com/libgit2/pygit2/pull/1266)
340+
341+
- New `Repository.submodules` namespace
342+
[#1250](https://github.com/libgit2/pygit2/pull/1250)
343+
344+
- New `Repository.listall_mergeheads()`, `Repository.message`,
345+
`Repository.raw_message` and `Repository.remove_message()`
346+
[#1261](https://github.com/libgit2/pygit2/pull/1261)
347+
348+
- New `pygit2.enums` supersedes the `GIT_` constants
349+
[#1251](https://github.com/libgit2/pygit2/pull/1251)
350+
351+
- Now `Repository.status()`, `Repository.status_file()`,
352+
`Repository.merge_analysis()`, `DiffFile.flags`, `DiffFile.mode`,
353+
`DiffDelta.flags` and `DiffDelta.status` return enums
354+
[#1263](https://github.com/libgit2/pygit2/pull/1263)
355+
356+
- Now repository\'s `merge()`, `merge_commits()` and `merge_trees()`
357+
take enums/flags for their `favor`, `flags` and `file_flags` arguments.
358+
[#1271](https://github.com/libgit2/pygit2/pull/1271)
359+
[#1272](https://github.com/libgit2/pygit2/pull/1272)
360+
361+
- Fix crash in filter cleanup
362+
[#1259](https://github.com/libgit2/pygit2/pull/1259)
363+
364+
- Documentation fixes
365+
[#1255](https://github.com/libgit2/pygit2/pull/1255)
366+
[#1258](https://github.com/libgit2/pygit2/pull/1258)
367+
[#1268](https://github.com/libgit2/pygit2/pull/1268)
368+
[#1270](https://github.com/libgit2/pygit2/pull/1270)
353369

354370
Breaking changes:
355371

pygit2/index.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -446,15 +446,9 @@ def __init__(
446446

447447
@property
448448
def oid(self):
449-
# For backwards compatibility
449+
warnings.warn('Use entry.id', DeprecationWarning)
450450
return self.id
451451

452-
@property
453-
def hex(self):
454-
"""The id of the referenced object as a hex string"""
455-
warnings.warn('Use str(entry.id)', DeprecationWarning)
456-
return str(self.id)
457-
458452
def __str__(self):
459453
return f'<path={self.path} id={self.id} mode={self.mode}>'
460454

0 commit comments

Comments
 (0)