diff options
| author | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-05-20 13:55:05 +0300 |
|---|---|---|
| committer | Syndamia <kamen.d.mladenov@protonmail.com> | 2021-05-20 13:55:05 +0300 |
| commit | 723cce0f413ff3984b8605e56090987a67834b5c (patch) | |
| tree | 19ecb7bff9c4dbecef6ee089719e31dfbcdda66f /reposync.py | |
| parent | 3c01b8f5d01df345f32c21a86b8e7fe0db90ce01 (diff) | |
| download | RepoSync-723cce0f413ff3984b8605e56090987a67834b5c.tar RepoSync-723cce0f413ff3984b8605e56090987a67834b5c.tar.gz RepoSync-723cce0f413ff3984b8605e56090987a67834b5c.zip | |
Added a script for creating a systemd service and systemd timer files; Slightly improved some code in main script
Diffstat (limited to 'reposync.py')
| -rwxr-xr-x | reposync.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/reposync.py b/reposync.py index 083ef74..6aaf47d 100755 --- a/reposync.py +++ b/reposync.py @@ -6,11 +6,10 @@ import os repoFile = open("repositories.txt", "r") while(True): - line = repoFile.readline() + line = repoFile.readline().strip() if not line: break - line = line.strip() now = datetime.now().strftime("[%H:%M:%S] ") if not os.path.isdir(line): print("\033[0;31m%s\033[0;0m \033[0;34m%s\033[0;0m is not a directory!"%(now, line)) @@ -22,11 +21,11 @@ while(True): # Thanks to https://stackoverflow.com/a/65535263/12036073 if list(repo.iter_commits(f'{branch}..{branch}@{{u}}')): - print("\033[0;31m%s\033[0;34m%s\033[0;0m\'s origin was updated, pulling..."%(now, line)) + print(f'\033[0;31m{now}\033[0;34m{line}\033[0;0m\'s origin was updated, pulling...') repo.remotes.origin.pull() else: - print("\033[0;32m%s\033[0;34m%s\033[0;0m is up to date"%(now, line)) + print(f'\033[0;32m{now}\033[0;34m{line}\033[0;0m is up to date') else: - print("\033[0;31m%s\033[0;0m Repository \033[0;34m%s\033[0;0m must not be bare!"%(now, line)) + print(f'\033[0;31m{now}\033[0;0m Repository \033[0;34m{line}\033[0;0m must not be bare!') repoFile.close() |
