From cd7003a5bb8cf022044ee0fe0e10e5e601dbfcf2 Mon Sep 17 00:00:00 2001 From: Kari Oikarinen Date: Tue, 27 Aug 2019 09:58:10 +0300 Subject: branch_qt.py: Handle merges that have conflicts Note that the merge had conflicts and those need to be resolved manually and continue for all the other modules. Change-Id: Id4409bf16e8ea22ef7dc32d92b38a0a0adf75f60 Reviewed-by: Paul Wicking Reviewed-by: Frederik Gladhorn --- scripts/qt/branch_qt.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/qt/branch_qt.py b/scripts/qt/branch_qt.py index 910f27aa..022590da 100755 --- a/scripts/qt/branch_qt.py +++ b/scripts/qt/branch_qt.py @@ -250,14 +250,19 @@ class QtBranching: def merge_repo(self, repo: git.Repo) -> None: log.info(f"Merge: {repo.working_dir}") + push_merge = lambda: self.subprocess_or_pretend(f'git push gerrit {self.toBranch}:{self.toBranch}'.split(), check=True) self.checkout_and_pull_branch(repo, self.toBranch) try: subprocess.run(f'git merge --ff-only --quiet gerrit/{self.fromBranch}'.split(), check=True, stderr=subprocess.PIPE) + push_merge() except subprocess.CalledProcessError: # The merge was not fast forward, try again - log.info(f" Attempting non ff merge for {repo.working_dir}") - subprocess.run(['git', 'merge', f'gerrit/{self.fromBranch}', '--quiet', '-m', f'Merge {self.fromBranch} into {self.toBranch}'], check=True) - self.subprocess_or_pretend(f'git push gerrit {self.toBranch}:{self.toBranch}'.split(), check=True) + try: + log.info(f" Attempting non ff merge for {repo.working_dir}") + subprocess.run(['git', 'merge', f'gerrit/{self.fromBranch}', '--quiet', '-m', f'Merge {self.fromBranch} into {self.toBranch}'], check=True) + push_merge() + except subprocess.CalledProcessError: + log.warning(f" Merge had conflicts. {repo.working_dir} needs to be merged manually!") def version_bump_repo(self, repo: git.Repo) -> None: qmake_conf_file_name = '.qmake.conf' -- cgit v1.2.3