blob: 2eac23c80c1cd95783e737073c1279d71332af37 (
plain)
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
26
27
28
29
30
31
|
#!/usr/bin/env python3
import git
import os
import sys
from datetime import datetime, timezone
REPOS = "/var/www/git.jordan.im/repositories"
for x in os.listdir(REPOS):
if not os.path.isdir(os.path.join(REPOS, x)):
continue
print(f"processing {x}...")
try:
repo = git.Repo(os.path.join(REPOS, x))
for remote in repo.remotes:
remote.fetch()
md = repo.head.commit.committed_datetime
md = md.astimezone(timezone.utc).strftime("%Y-%m-%d %H:%M:%S")
except Exception as e:
sys.stderr.write(str(e))
continue
d = os.path.join(REPOS, x, "info/web/")
os.makedirs(d, exist_ok=True)
f = open(os.path.join(d, "last-modified"), "w")
f.write(md)
f.close()
|