41 lines
1023 B
Python
41 lines
1023 B
Python
|
# check git commit
|
||
|
from action_runner import ActionRunner
|
||
|
|
||
|
import os, sys, json, traceback
|
||
|
|
||
|
from PyQt6.QtWidgets import QApplication
|
||
|
|
||
|
|
||
|
class CommitChecker:
|
||
|
"""
|
||
|
This class is used to check the git commit status of the repository.
|
||
|
"""
|
||
|
def __init__(self):
|
||
|
pass
|
||
|
|
||
|
def CheckCommit(self):
|
||
|
"""
|
||
|
This function checks the git commit status of the repository.
|
||
|
"""
|
||
|
try:
|
||
|
process = ActionRunner("git status")
|
||
|
output = process.run()
|
||
|
print(output)
|
||
|
if "nothing to commit, working tree clean" in output:
|
||
|
return True
|
||
|
else:
|
||
|
return False
|
||
|
except Exception as e:
|
||
|
print("### Error while checking git commit status ###")
|
||
|
traceback.print_exc()
|
||
|
return False
|
||
|
except:
|
||
|
pass
|
||
|
|
||
|
return False
|
||
|
|
||
|
if __name__ == '__main__':
|
||
|
app = QApplication([])
|
||
|
checker = CommitChecker()
|
||
|
print(checker.CheckCommit())
|
||
|
sys.exit(app.exec())
|