aboutsummaryrefslogtreecommitdiff
path: root/reposync.py
diff options
context:
space:
mode:
authorSyndamia <kamen.d.mladenov@protonmail.com>2021-05-20 11:15:08 +0300
committerSyndamia <kamen.d.mladenov@protonmail.com>2021-05-20 11:15:08 +0300
commitdc67a9a7c6d93dd3a6a9b2cb2e001b11698432ba (patch)
tree3657311400bef879708c82e631178f7bad175cd2 /reposync.py
parenteb1c9494a6751a31fcc784ebc13e947d22f663bf (diff)
downloadRepoSync-dc67a9a7c6d93dd3a6a9b2cb2e001b11698432ba.tar
RepoSync-dc67a9a7c6d93dd3a6a9b2cb2e001b11698432ba.tar.gz
RepoSync-dc67a9a7c6d93dd3a6a9b2cb2e001b11698432ba.zip
Moved repository paths to a file
Diffstat (limited to 'reposync.py')
-rw-r--r--reposync.py32
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()