mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Allow for pygit2 enums not available, early version of pygit2
This commit is contained in:
parent
41c3d0974c
commit
03df109113
1 changed files with 15 additions and 4 deletions
|
@ -24,7 +24,13 @@ if HAS_PYGIT2:
|
|||
import pygit2
|
||||
|
||||
## DGM
|
||||
from pygit2.enums import ObjectType
|
||||
try:
|
||||
from pygit2.enums import ObjectType
|
||||
|
||||
HAS_PYGIT2_ENUMS = True
|
||||
|
||||
except AttributeError:
|
||||
HAS_PYGIT2_ENUMS = False
|
||||
|
||||
|
||||
@pytest.fixture
|
||||
|
@ -153,9 +159,14 @@ def _prepare_remote_repository_pygit2(tmp_path):
|
|||
## DGM repository.create_tag(
|
||||
## DGM "annotated_tag", commit, pygit2.GIT_OBJ_COMMIT, signature, "some message"
|
||||
## DGM )
|
||||
repository.create_tag(
|
||||
"annotated_tag", commit, ObjectType.COMMIT, signature, "some message"
|
||||
)
|
||||
if HAS_PYGIT2_ENUMS:
|
||||
repository.create_tag(
|
||||
"annotated_tag", commit, ObjectType.COMMIT, signature, "some message"
|
||||
)
|
||||
else:
|
||||
repository.create_tag(
|
||||
"annotated_tag", commit, pygit2.GIT_OBJ_COMMIT, signature, "some message"
|
||||
)
|
||||
return remote
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue