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 152DF1382C5 for ; Mon, 19 Feb 2018 15:01:19 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 1542FE0ABA; Mon, 19 Feb 2018 15:01:10 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (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 DF0E2E0AB9 for ; Mon, 19 Feb 2018 15:01:09 +0000 (UTC) Received: from localhost.localdomain (d202-252.icpnet.pl [109.173.202.252]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: mgorny) by smtp.gentoo.org (Postfix) with ESMTPSA id 3A1D5335C33; Mon, 19 Feb 2018 15:01:08 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: gentoo-portage-dev@lists.gentoo.org Cc: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Subject: [gentoo-portage-dev] [PATCH v3 3/3] repoman: Verify commit messages when using EDITOR Date: Mon, 19 Feb 2018 16:00:57 +0100 Message-Id: <20180219150057.20338-3-mgorny@gentoo.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180219150057.20338-1-mgorny@gentoo.org> References: <20180219150057.20338-1-mgorny@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org X-Archives-Salt: a82a0705-a176-4569-8a09-621707dbf966 X-Archives-Hash: cd04b2144602ae509c179287ff84192c --- 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): -- 2.16.2