From: "Michał Górny" <mgorny@gentoo.org>
To: gentoo-portage-dev@lists.gentoo.org
Cc: "Michał Górny" <mgorny@gentoo.org>
Subject: [gentoo-portage-dev] [PATCH v3 3/3] repoman: Verify commit messages when using EDITOR
Date: Mon, 19 Feb 2018 16:00:57 +0100 [thread overview]
Message-ID: <20180219150057.20338-3-mgorny@gentoo.org> (raw)
In-Reply-To: <20180219150057.20338-1-mgorny@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):
--
2.16.2
next prev parent reply other threads:[~2018-02-19 15:01 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-19 15:00 [gentoo-portage-dev] [PATCH v3 1/3] repoman: Add commit message verification Michał Górny
2018-02-19 15:00 ` [gentoo-portage-dev] [PATCH v3 2/3] repoman: Remove support for getting messages from stdin Michał Górny
2018-02-19 15:00 ` Michał Górny [this message]
2018-02-20 19:56 ` [gentoo-portage-dev] [PATCH v3 1/3] repoman: Add commit message verification Brian Dolbec
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180219150057.20338-3-mgorny@gentoo.org \
--to=mgorny@gentoo.org \
--cc=gentoo-portage-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox