diff --git a/app/repo.py b/app/repo.py index 5233098..1964383 100644 --- a/app/repo.py +++ b/app/repo.py @@ -1,6 +1,7 @@ from git import Repo, InvalidGitRepositoryError, Git from config import cfg import logging as log +from datetime import datetime def check_remote_repo(repo: Repo): @@ -52,15 +53,16 @@ def check_bcp_repo(path: str = cfg.bcp.dir) -> None: def add_file_and_commit(file_name: str) -> None: + current_time = datetime.now().strftime("%Y-%m-%d %H:%M:%S") repo = Repo(cfg.bcp.dir) if file_name in repo.untracked_files: repo.git.add(file_name) + repo.index.commit("add %s %s" % (file_name, current_time)) log.info("%r added in repo", file_name) - repo.index.commit("add file %s" % file_name) if bool(repo.git.diff(file_name)): repo.index.add([file_name]) - repo.index.commit("update file %s" % file_name) + repo.index.commit("update %s %s" % (file_name, current_time)) log.info("change in %r commited", file_name) else: log.info("no changed in file %r", file_name)