From ebd553f405aa9bd2b1d5d946183c96e91a02462e Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Sun, 3 May 2020 21:21:28 +0200 Subject: [PATCH] If the mirrored repo has a remote, try mirroring the changes pulled to it Signed-off-by: Pierre-Yves Chibon --- mirror_from_pagure_bus.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mirror_from_pagure_bus.py b/mirror_from_pagure_bus.py index 82db9b7..8c3ba97 100644 --- a/mirror_from_pagure_bus.py +++ b/mirror_from_pagure_bus.py @@ -107,6 +107,16 @@ class MirrorFromPagure(object): cmd = ["git", "-c", "transfer.fsckObjects=1", "fetch"] run_command(cmd, cwd=dest_folder) + cmd = ["git", "remote"] + output = run_command(cmd, cwd=dest_folder).decode("utf-8").strip() + if output: + for remote in output.split("\n"): + _log.info(" Running git push --mirror against %s", remote) + cmd = ["git", "push", "--mirror", remote] + run_command(cmd, cwd=dest_folder) + else: + _log.info(" No remotes found") + except Exception: _log.exception("Something happened while calling git") if cnt >= 3: