From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id CB1EA138332 for ; Tue, 27 Feb 2018 19:07:08 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id F0380E0969; Tue, 27 Feb 2018 19:07:07 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id C6D4CE0968 for ; Tue, 27 Feb 2018 19:07:07 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 7F197335C0C for ; Tue, 27 Feb 2018 19:07:06 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 3BFA021C for ; Tue, 27 Feb 2018 19:07:05 +0000 (UTC) From: "Michał Górny" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Michał Górny" Message-ID: <1519758416.d9073997f41e113fe8b5261797ee92b38c8a04a5.mgorny@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: repoman/pym/repoman/ X-VCS-Repository: proj/portage X-VCS-Files: repoman/pym/repoman/actions.py X-VCS-Directories: repoman/pym/repoman/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: d9073997f41e113fe8b5261797ee92b38c8a04a5 X-VCS-Branch: master Date: Tue, 27 Feb 2018 19:07:05 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: add95e53-a9e2-40bb-ac81-83f965246289 X-Archives-Hash: 5bc18b0344b3794b1e998db1b4616606 commit: d9073997f41e113fe8b5261797ee92b38c8a04a5 Author: Michał Górny gentoo org> AuthorDate: Sat Feb 17 12:32:57 2018 +0000 Commit: Michał Górny gentoo org> CommitDate: Tue Feb 27 19:06:56 2018 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=d9073997 repoman: Verify commit messages when using EDITOR Reviewed-by: Brian Dolbec gentoo.org> repoman/pym/repoman/actions.py | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/repoman/pym/repoman/actions.py b/repoman/pym/repoman/actions.py index cd954223a..8e23322c8 100644 --- a/repoman/pym/repoman/actions.py +++ b/repoman/pym/repoman/actions.py @@ -129,7 +129,23 @@ class Actions(object): else: sys.exit(1) else: - commitmessage = self.get_new_commit_message(qa_output) + commitmessage = None + msg_qa_output = qa_output + initial_message = None + while True: + commitmessage = self.get_new_commit_message( + msg_qa_output, commitmessage) + res, expl = self.verify_commit_message(commitmessage) + if res: + break + else: + full_expl = '''Issues with the commit message were found. Please fix it or remove +the whole commit message to abort. + +''' + expl + msg_qa_output = ( + [' %s\n' % x for x in full_expl.splitlines()] + + qa_output) commitmessage = commitmessage.rstrip() @@ -577,8 +593,8 @@ class Actions(object): prefix = "/".join(self.scanner.reposplit[1:]) + ": " return prefix - def get_new_commit_message(self, qa_output): - msg_prefix = self.msg_prefix() + def get_new_commit_message(self, qa_output, old_message=None): + msg_prefix = old_message or self.msg_prefix() try: editor = os.environ.get("EDITOR") if editor and utilities.editor_is_executable(editor):