2022-08-14 18:16:59 -05:00
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
from pathlib import Path
|
|
|
|
import shutil
|
|
|
|
|
|
|
|
GITEA_REPOS = Path(__file__).parent / "gitea/git/repositories/daylin"
|
|
|
|
SOFT_REPOS = Path(__file__).parent / "soft/repos"
|
|
|
|
|
2022-08-14 18:40:37 -05:00
|
|
|
allowed = ["dotfiles", "git-server"]
|
|
|
|
soft_serve_only = ["config"]
|
2022-08-14 18:16:59 -05:00
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
|
|
|
|
for repo in GITEA_REPOS.iterdir():
|
|
|
|
name = repo.name.replace(".git", "")
|
2022-08-14 18:40:37 -05:00
|
|
|
dest = SOFT_REPOS / name
|
|
|
|
if name not in [*allowed, *soft_serve_only]:
|
2022-08-14 18:16:59 -05:00
|
|
|
continue
|
|
|
|
|
2022-08-14 18:40:37 -05:00
|
|
|
print(f"{repo} >> {dest}")
|
2022-08-14 18:16:59 -05:00
|
|
|
|
|
|
|
if dest.is_dir():
|
|
|
|
shutil.rmtree(dest)
|
|
|
|
shutil.copytree(repo, dest)
|
|
|
|
|
2022-08-14 18:40:37 -05:00
|
|
|
for repo in SOFT_REPOS.iterdir():
|
|
|
|
name = repo.name.replace(".git", "")
|
|
|
|
dest = SOFT_REPOS / name
|
|
|
|
if name not in [*allowed, *soft_serve_only]:
|
|
|
|
print(f"pruning {name}")
|
|
|
|
shutil.rmtree(repo)
|
|
|
|
|
2022-08-14 18:16:59 -05:00
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|