diff options
author | Blaise Thompson <blaise@untzag.com> | 2021-06-17 20:41:39 -0500 |
---|---|---|
committer | Blaise Thompson <blaise@untzag.com> | 2021-06-17 20:41:39 -0500 |
commit | 530d2d27806c15743019056f89d0854a93762854 (patch) | |
tree | ecc5f3cd34f97b3c2342f78cd34613c642d19c8c |
initial commit
-rw-r--r-- | README.md | 1 | ||||
-rw-r--r-- | mirror.py | 20 | ||||
-rw-r--r-- | mirrors.toml | 5 |
3 files changed, 26 insertions, 0 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..0609a22 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# git mirror worker diff --git a/mirror.py b/mirror.py new file mode 100644 index 0000000..0ffff6c --- /dev/null +++ b/mirror.py @@ -0,0 +1,20 @@ +import toml +import pathlib +import os + +__here__ = pathlib.Path(__file__).parent + +with open(__here__ / "mirrors.toml", "r") as f: + repositories = toml.load(f) + +for path in repositories.keys(): + pathlib.mkdir(path, exist_ok=True) + local_path = pathlib.Path(path) + primary_url = repositories[path]["primary"] + secondary_urls = repositories[path]["secondary"] + if os.path.isfile(local_path / "git-daemon-export-ok"): + subprocess.run(["git", "remote", "update", primary_url]) + else: + # TODO: clone repository + pass + diff --git a/mirrors.toml b/mirrors.toml new file mode 100644 index 0000000..71f8c5d --- /dev/null +++ b/mirrors.toml @@ -0,0 +1,5 @@ +["uw-madison-chem-shops/wisconsin-photoreactor.git"] +primary = "https://github.com/uw-madison-chem-shops/wisconsin-photoreactor.git" +secondary = ["git@git.chem.wisc.edu:gellman-group/wisconsin-photoreactor.git", + "git@gitlab.com:uw-madison-chem-shops/wisconsin-photoreactor.git"] + |