Files
lewangoalski/FlaskWebProject/FlaskWebProject/lewy_globals.py

16 lines
421 B
Python

from git import Repo # hash ostatniego commitu
def getCommit():
try:
return Repo(search_parent_directories=True).head.object.hexsha
except:
return None
def getCommitInFormattedHTML():
repo = "<p>Brak informacji o wersji skryptu</p>"
commit = getCommit()
if commit is not None:
repo = f"<p>Commit: <a href='https://gitea.7o7.cx/roberteam/lewangoalski/commit/{commit}'>{commit[:11]}</a></p>"
return repo