summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorThibault Saunier <tsaunier@igalia.com>2021-09-29 10:07:48 -0300
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2021-09-29 22:10:27 +0000
commit18378ec8c797f6b9d10427b52d0fe7e088d59d4b (patch)
treedc2c287266d8b5cf825f673fafe1e221e9902257 /scripts
parentbe616121b8c3ba23e835a6c32aa3b6cb27d7fba1 (diff)
downloadgstreamer-18378ec8c797f6b9d10427b52d0fe7e088d59d4b.tar.gz
scripts:move_mrs: Revert cherry-picking when aborting
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/959>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/move_mrs_to_monorepo.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/scripts/move_mrs_to_monorepo.py b/scripts/move_mrs_to_monorepo.py
index 7044ddbd99..f42bd7f2f3 100755
--- a/scripts/move_mrs_to_monorepo.py
+++ b/scripts/move_mrs_to_monorepo.py
@@ -215,7 +215,7 @@ class GstMRMover:
' then set it in the "GITLAB_API_TOKEN" environment variable:"'
f'\n\n $ GITLAB_API_TOKEN=<your token> {" ".join(sys.argv)}\n'))
- def git(self, *args, can_fail=False, interaction_message=None, call=False):
+ def git(self, *args, can_fail=False, interaction_message=None, call=False, revert_operation=None):
cwd = ROOT_DIR
retry = True
while retry:
@@ -265,8 +265,12 @@ class GstMRMover:
retry = True
continue
elif e.returncode == 2:
+ if revert_operation:
+ self.git(*revert_operation, can_fail=True)
return "SKIP"
elif e.returncode == 3:
+ if revert_operation:
+ self.git(*revert_operation, can_fail=True)
sys.exit(3)
except:
# Result of subshell does not really matter
@@ -468,9 +472,9 @@ class GstMRMover:
for commit in reversed([c for c in mr.commits()]):
if self.git("cherry-pick", commit.id,
interaction_message=f"cherry-picking {commit.id} onto {branch} with:\n "
- f" `$ git cherry-pick {commit.id}`") == "SKIP":
+ f" `$ git cherry-pick {commit.id}`",
+ revert_operation=["cherry-pick", "--abort"]) == "SKIP":
fprint(f"{yellow('SKIPPED')} (couldn't cherry-pick).", nested=False)
- self.git("cherry-pick", "--abort", can_fail=True)
return False
self.git("show", remote_branch + "..", call=True)