diff options
author | ame <[email protected]> | 2025-03-03 03:07:15 -0600 |
---|---|---|
committer | ame <[email protected]> | 2025-03-03 03:07:15 -0600 |
commit | bb96c6e30f393bb135e2f6b7ddb314027f0aee54 (patch) | |
tree | 9e26ea7d6eb41633436edc6091d01b6a3bb6b12d /src/sync.py | |
parent | 73cbed952c5d2cdfdaceb5f8c2b19c77738b5186 (diff) |
qol update
Diffstat (limited to 'src/sync.py')
-rw-r--r-- | src/sync.py | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/sync.py b/src/sync.py index 8a1a94e..822104f 100644 --- a/src/sync.py +++ b/src/sync.py @@ -1,15 +1,19 @@ from common import * import copy -def sync_obj(repo_name: str) -> None: +def sync_obj(repo_name: str) -> str: if not repo_name in tracked: - return + return "" + cmds = "" for p in tracked[repo_name]: - copy.copy([{"path":p, "repo": repo_name, "full_path": os.path.join(REPO_LOC, repo_name, p)}]) + cmds += str(copy.copy([{"path":p, "repo": repo_name, "full_path": os.path.join(REPO_LOC, repo_name, p)}])) + return cmds def sync(sync_repos: list[repo_pair]) -> None: + cmds = "" for r in sync_repos: + print(r) full_path = os.path.join(REPO_LOC, r["name"]) if os.path.isdir(full_path): @@ -19,17 +23,20 @@ def sync(sync_repos: list[repo_pair]) -> None: new_hash = subprocess.getoutput(f"cd {full_path} && git rev-parse HEAD") if old_hash == new_hash: - print(f"{r["name"]}: up to date") + print(f"{r['name']}: up to date") else: - print(f"{r["name"]}: {new_hash}") + print(f"{r['name']}: {new_hash}") else: - os.system(f"cd {REPO_LOC} && git clone {r["url"]} {r["name"]}") + os.system(f"cd {REPO_LOC} && git clone {r['url']} {r['name']}") new_hash = subprocess.getoutput(f"cd {full_path} && git rev-parse HEAD") - print(f"{r["name"]}: {new_hash}") + print(f"{r['name']}: {new_hash}") if questionary.confirm("would you like to sync all tracked packages, from this repo?").ask(): - sync_obj(r["name"]) + cmds += sync_obj(r["name"]) + + if cmds != "": + eexec(cmds) |