You'll need to extract the pygit2 status codes. Here's an example.
Output of git status
for some unstaged commits:
On branch master
Changes not staged for commit:
deleted: deleted.txt
modified: modified.txt
Untracked files:
added.txt
pygit2 status output
repo.status()
#{'added.txt': 128, 'deleted.txt': 512, 'modified.txt': 256}
Status codes from pygit2
from pygit2 import GIT_STATUS_WT_NEW, GIT_STATUS_WT_DELETED, GIT_STATUS_WT_MODIFIED
print("GIT_STATUS_WT_NEW", GIT_STATUS_WT_NEW)
print("GIT_STATUS_WT_DELETED", GIT_STATUS_WT_DELETED)
print("GIT_STATUS_WT_MODIFIED", GIT_STATUS_WT_MODIFIED)
#GIT_STATUS_WT_NEW 128
#GIT_STATUS_WT_DELETED 512
#GIT_STATUS_WT_MODIFIED 256
For staged commits, the relevant status codes are GIT_STATUS_INDEX_NEW
, GIT_STATUS_INDEX_DELETED
, GIT_STATUS_INDEX_MODIFIED
, and so on.