blob: e0f8e0913eeb15fa198830d12fe41fdff4ba070f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
|
import toml
import pathlib
import os
import subprocess
__here__ = pathlib.Path(__file__).parent
with open("mirrors.toml", "r") as f:
repositories = toml.load(f)
for path in repositories.keys():
local_path = pathlib.Path("/git") / pathlib.Path(path)
local_path.mkdir(exist_ok=True, parents=True)
secondary_urls = repositories[path]["secondary"]
os.chdir(str(local_path))
subprocess.run(["git", "remote", "update"])
subprocess.run(["git", "fetch", "origin", "'*:*'"])
for url in secondary_urls:
print(url)
subprocess.run(["git", "push", url, "--all"])
|