diff options
Diffstat (limited to 'reposync.py')
| -rw-r--r-- | reposync.py | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/reposync.py b/reposync.py index 7cf156a..9e0524b 100644 --- a/reposync.py +++ b/reposync.py @@ -1,17 +1,25 @@ from git import Repo from datetime import datetime -repo = Repo("./") -if not repo.bare: - now = datetime.now().strftime("[%H:%M:%S] ") - branch = repo.active_branch +repoFile = open("repositories.txt", "r") - # Thanks to https://stackoverflow.com/a/65535263/12036073 - if list(repo.iter_commits(f'{branch}..{branch}@{{u}}')): - print(now + "Remote changes detected, pulling...") - repo.remotes.origin.pull() - else: - print(now + "Up to date") +while(True): + line = repoFile.readline() + if not line: + break -else: - print("Repository must not be bare!") + repo = Repo(line.strip()) + if not repo.bare: + now = datetime.now().strftime("[%H:%M:%S] ") + branch = repo.active_branch + + # Thanks to https://stackoverflow.com/a/65535263/12036073 + if list(repo.iter_commits(f'{branch}..{branch}@{{u}}')): + print(now + line.strip() + "'s origin was updated, pulling...") + repo.remotes.origin.pull() + else: + print(now + line.strip() + " is up to date") + else: + print("Repository must not be bare!") + +repoFile.close() |
