2024-04-22 13:15:18 +00:00
|
|
|
# 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())
|
2024-04-22 13:19:16 +00:00
|
|
|
sys.exit(app.exec())
|
|
|
|
|
|
|
|
########
|
|
|
|
# TEST #
|
|
|
|
########
|