mirror of
https://github.com/daylinmorgan/git-server.git
synced 2024-12-22 03:40:44 -06:00
add pruning step for old repos
This commit is contained in:
parent
55712d78ef
commit
b912dd027a
1 changed files with 13 additions and 6 deletions
|
@ -6,24 +6,31 @@ import shutil
|
||||||
GITEA_REPOS = Path(__file__).parent / "gitea/git/repositories/daylin"
|
GITEA_REPOS = Path(__file__).parent / "gitea/git/repositories/daylin"
|
||||||
SOFT_REPOS = Path(__file__).parent / "soft/repos"
|
SOFT_REPOS = Path(__file__).parent / "soft/repos"
|
||||||
|
|
||||||
allowed = ["dotfiles", "gitea-server"]
|
allowed = ["dotfiles", "git-server"]
|
||||||
|
soft_serve_only = ["config"]
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
for repo in GITEA_REPOS.iterdir():
|
for repo in GITEA_REPOS.iterdir():
|
||||||
name = repo.name.replace(".git", "")
|
name = repo.name.replace(".git", "")
|
||||||
if name not in allowed:
|
|
||||||
continue
|
|
||||||
print(repo)
|
|
||||||
|
|
||||||
dest = SOFT_REPOS / name
|
dest = SOFT_REPOS / name
|
||||||
print(f">> {dest}")
|
if name not in [*allowed, *soft_serve_only]:
|
||||||
|
continue
|
||||||
|
|
||||||
|
print(f"{repo} >> {dest}")
|
||||||
|
|
||||||
if dest.is_dir():
|
if dest.is_dir():
|
||||||
shutil.rmtree(dest)
|
shutil.rmtree(dest)
|
||||||
shutil.copytree(repo, dest)
|
shutil.copytree(repo, dest)
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Reference in a new issue