blob: 9e0524b0f7651a87cb338bda4918f0a07709b533 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
from git import Repo
from datetime import datetime
repoFile = open("repositories.txt", "r")
while(True):
line = repoFile.readline()
if not line:
break
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()
|