From 1ef9007ed938d83fd7ed788a7fd7f7d4acd11ec2 Mon Sep 17 00:00:00 2001
From: Tim Jaacks <tim.jaacks@garz-fricke.com>
Date: Wed, 15 Dec 2021 12:50:50 +0100
Subject: [PATCH] accept_merge_request: explicitly remove source branch

A bug in python-gitlab > 2.7.0 [1] brought this up: In the past we
relied on the merge request's setting, whether the source branch should
be deleted or not after a merge. Since we're using the API's merge
function in a fully automated task, however, the branch should always be
deleted. Add the according argument explicitly.

[1]: https://github.com/python-gitlab/python-gitlab/issues/1750
---
 accept_merge_request.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/accept_merge_request.py b/accept_merge_request.py
index 3cd6ba37..b9df28d5 100755
--- a/accept_merge_request.py
+++ b/accept_merge_request.py
@@ -36,7 +36,7 @@ def accept_merge_request(project, mr, rebase=False):
 
         # Try to merge the merge request
         try:
-            mr.merge()
+            mr.merge(should_remove_source_branch=True)
             if pipeline_pending:
                 print("")
             if mr.state == "merged":
-- 
GitLab