Avoid check-out branches to speed-up windows slow fs
This commit is contained in:
parent
da998d8eec
commit
2fb0b910a9
@ -64,7 +64,7 @@ def sync_repo(nick, from_entry, to_entry, use_mirror, dry_run=False):
|
|||||||
"""
|
"""
|
||||||
Synchronizes a repository from from_entry to to_entry.
|
Synchronizes a repository from from_entry to to_entry.
|
||||||
Executes git fetch from the source and git push to the destination.
|
Executes git fetch from the source and git push to the destination.
|
||||||
If --mirror is used, performs full push of all refs. Otherwise, checks out all remote branches and pushes with --all and --tags.
|
If --mirror is used, performs full push of all refs. Otherwise, creates local tracking branches and pushes them without checking out.
|
||||||
"""
|
"""
|
||||||
_, _, from_remote, from_url, local_dir = from_entry
|
_, _, from_remote, from_url, local_dir = from_entry
|
||||||
_, _, to_remote, to_url, _ = to_entry
|
_, _, to_remote, to_url, _ = to_entry
|
||||||
@ -94,9 +94,9 @@ def sync_repo(nick, from_entry, to_entry, use_mirror, dry_run=False):
|
|||||||
for r in remotes:
|
for r in remotes:
|
||||||
if f'{from_remote}/' in r and '->' not in r:
|
if f'{from_remote}/' in r and '->' not in r:
|
||||||
branch = r.strip().split(f'{from_remote}/')[1]
|
branch = r.strip().split(f'{from_remote}/')[1]
|
||||||
subprocess.run(["git", "checkout", "-B", branch, f"{from_remote}/{branch}"], cwd=local_dir)
|
subprocess.run(["git", "branch", branch, f"{from_remote}/{branch}"], cwd=local_dir)
|
||||||
except subprocess.CalledProcessError as e:
|
except subprocess.CalledProcessError as e:
|
||||||
print(f"Error: Failed to checkout remote branches in {local_dir}\nMessage: {e}")
|
print(f"Error: Failed to create tracking branches in {local_dir}\nMessage: {e}")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
run_git(["git", "push", to_remote, "--all"], cwd=local_dir, dry_run=dry_run)
|
run_git(["git", "push", to_remote, "--all"], cwd=local_dir, dry_run=dry_run)
|
||||||
run_git(["git", "push", to_remote, "--tags"], cwd=local_dir, dry_run=dry_run)
|
run_git(["git", "push", to_remote, "--tags"], cwd=local_dir, dry_run=dry_run)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user