Skip to content

Commit

Permalink
Remove more deprecated code
Browse files Browse the repository at this point in the history
  • Loading branch information
jdavid committed Mar 25, 2024
1 parent 9bdbfe6 commit 95bbd1f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 31 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ Breaking changes:
- Remove deprecated `Repository.init_submodules(...)`, use `Repository.submodules.init(...)`
- Remove deprecated `Repository.update_submodule(...)`, use `Repository.submodules.update(...)`

- Remove deprecated constants `GIT_OBJ_XXX`, use `ObjectType`
- Remove deprecated constants `GIT_REVPARSE_XXX`, use `RevSpecFlag`
- Remove deprecated constants `GIT_REF_XXX`, use `ReferenceType`
- Remove deprecated `ReferenceType.OID`, use instead `ReferenceType.DIRECT`
- Remove deprecated `ReferenceType.LISTALL`, use instead `ReferenceType.ALL`

- Remove deprecated support for passing dicts to repository\'s `merge(...)`,
`merge_commits(...)` and `merge_trees(...)`. Instead pass `MergeFlag` for `flags`, and
`MergeFileFlag` for `file_flags`.
Expand Down
12 changes: 0 additions & 12 deletions pygit2/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -857,12 +857,6 @@ class MergeFileFlag(IntFlag):
keep the conflict markers in the file and accept that as the merge result.
"""

# Backward compatibility with old pygit2 flag names
_DEPRECATED_STANDARD_STYLE = STYLE_MERGE
_DEPRECATED_DIFF3_STYLE = STYLE_DIFF3
_DEPRECATED_PATIENCE = DIFF_PATIENCE
_DEPRECATED_MINIMAL = DIFF_MINIMAL


class MergeFlag(IntFlag):
"""
Expand Down Expand Up @@ -1024,12 +1018,6 @@ class ReferenceType(IntFlag):
ALL = C.GIT_REFERENCE_ALL
'Bitwise OR of (DIRECT | SYMBOLIC)'

# Deprecated entries
OID = DIRECT
'Deprecated, use DIRECT instead'
LISTALL = ALL
'Deprecated, use ALL instead'


class RepositoryInitFlag(IntFlag):
"""
Expand Down
15 changes: 0 additions & 15 deletions src/pygit2.c
Original file line number Diff line number Diff line change
Expand Up @@ -565,12 +565,6 @@ PyInit__pygit2(void)
ADD_CONSTANT_INT(m, GIT_FILEMODE_BLOB_EXECUTABLE)
ADD_CONSTANT_INT(m, GIT_FILEMODE_LINK)
ADD_CONSTANT_INT(m, GIT_FILEMODE_COMMIT)
/* Deprecated constants for backward compatibility with old Python code*/
ADD_CONSTANT_INT(m, GIT_OBJ_ANY)
ADD_CONSTANT_INT(m, GIT_OBJ_COMMIT)
ADD_CONSTANT_INT(m, GIT_OBJ_TREE)
ADD_CONSTANT_INT(m, GIT_OBJ_BLOB)
ADD_CONSTANT_INT(m, GIT_OBJ_TAG)

/*
* Log
Expand Down Expand Up @@ -612,11 +606,6 @@ PyInit__pygit2(void)
ADD_CONSTANT_INT(m, GIT_REFERENCES_ALL)
ADD_CONSTANT_INT(m, GIT_REFERENCES_BRANCHES)
ADD_CONSTANT_INT(m, GIT_REFERENCES_TAGS)
/* libgit2 deprecated enums */
ADD_CONSTANT_INT(m, GIT_REF_INVALID)
ADD_CONSTANT_INT(m, GIT_REF_OID)
ADD_CONSTANT_INT(m, GIT_REF_SYMBOLIC)
ADD_CONSTANT_INT(m, GIT_REF_LISTALL)

/*
* RevSpec
Expand All @@ -626,10 +615,6 @@ PyInit__pygit2(void)
ADD_CONSTANT_INT(m, GIT_REVSPEC_SINGLE)
ADD_CONSTANT_INT(m, GIT_REVSPEC_RANGE)
ADD_CONSTANT_INT(m, GIT_REVSPEC_MERGE_BASE)
/* libgit2 deprecated enums */
ADD_CONSTANT_INT(m, GIT_REVPARSE_SINGLE)
ADD_CONSTANT_INT(m, GIT_REVPARSE_RANGE)
ADD_CONSTANT_INT(m, GIT_REVPARSE_MERGE_BASE)

/*
* Worktree
Expand Down
4 changes: 0 additions & 4 deletions test/test_refs.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ def test_refs_set_sha_prefix(testrepo):
def test_refs_get_type(testrepo):
reference = testrepo.references.get('refs/heads/master')
assert reference.type == ReferenceType.DIRECT
assert reference.type == ReferenceType.OID # deprecated


def test_refs_get_target(testrepo):
Expand Down Expand Up @@ -193,7 +192,6 @@ def test_refs_resolve(testrepo):
assert reference.type == ReferenceType.SYMBOLIC
reference = reference.resolve()
assert reference.type == ReferenceType.DIRECT
assert reference.type == ReferenceType.OID # deprecated
assert reference.target.hex == LAST_COMMIT


Expand Down Expand Up @@ -540,7 +538,6 @@ def test_reference_set_sha_prefix(testrepo):
def test_reference_get_type(testrepo):
reference = testrepo.lookup_reference('refs/heads/master')
assert reference.type == ReferenceType.DIRECT
assert reference.type == ReferenceType.OID # deprecated


def test_get_target(testrepo):
Expand Down Expand Up @@ -633,7 +630,6 @@ def test_reference_resolve(testrepo):
assert reference.type == ReferenceType.SYMBOLIC
reference = reference.resolve()
assert reference.type == ReferenceType.DIRECT
assert reference.type == ReferenceType.OID # deprecated
assert reference.target.hex == LAST_COMMIT


Expand Down

0 comments on commit 95bbd1f

Please sign in to comment.