diff options
| author | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-05-20 11:15:08 +0300 |
|---|---|---|
| committer | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-05-20 11:15:08 +0300 |
| commit | dc67a9a7c6d93dd3a6a9b2cb2e001b11698432ba (patch) | |
| tree | 3657311400bef879708c82e631178f7bad175cd2 /reposync.py | |
| parent | eb1c9494a6751a31fcc784ebc13e947d22f663bf (diff) | |
| download | RepoSync-dc67a9a7c6d93dd3a6a9b2cb2e001b11698432ba.tar RepoSync-dc67a9a7c6d93dd3a6a9b2cb2e001b11698432ba.tar.gz RepoSync-dc67a9a7c6d93dd3a6a9b2cb2e001b11698432ba.zip | |
Moved repository paths to a file
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() |
