Gentoo Archives: gentoo-commits

From: "Michał Górny" <mgorny@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/portage:master commit in: repoman/pym/repoman/
Date: Tue, 27 Feb 2018 19:07:08
Message-Id: 1519758416.d9073997f41e113fe8b5261797ee92b38c8a04a5.mgorny@gentoo
1 commit: d9073997f41e113fe8b5261797ee92b38c8a04a5
2 Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
3 AuthorDate: Sat Feb 17 12:32:57 2018 +0000
4 Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
5 CommitDate: Tue Feb 27 19:06:56 2018 +0000
6 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=d9073997
7
8 repoman: Verify commit messages when using EDITOR
9
10 Reviewed-by: Brian Dolbec <dolsen <AT> gentoo.org>
11
12 repoman/pym/repoman/actions.py | 22 +++++++++++++++++++---
13 1 file changed, 19 insertions(+), 3 deletions(-)
14
15 diff --git a/repoman/pym/repoman/actions.py b/repoman/pym/repoman/actions.py
16 index cd954223a..8e23322c8 100644
17 --- a/repoman/pym/repoman/actions.py
18 +++ b/repoman/pym/repoman/actions.py
19 @@ -129,7 +129,23 @@ class Actions(object):
20 else:
21 sys.exit(1)
22 else:
23 - commitmessage = self.get_new_commit_message(qa_output)
24 + commitmessage = None
25 + msg_qa_output = qa_output
26 + initial_message = None
27 + while True:
28 + commitmessage = self.get_new_commit_message(
29 + msg_qa_output, commitmessage)
30 + res, expl = self.verify_commit_message(commitmessage)
31 + if res:
32 + break
33 + else:
34 + full_expl = '''Issues with the commit message were found. Please fix it or remove
35 +the whole commit message to abort.
36 +
37 +''' + expl
38 + msg_qa_output = (
39 + [' %s\n' % x for x in full_expl.splitlines()]
40 + + qa_output)
41
42 commitmessage = commitmessage.rstrip()
43
44 @@ -577,8 +593,8 @@ class Actions(object):
45 prefix = "/".join(self.scanner.reposplit[1:]) + ": "
46 return prefix
47
48 - def get_new_commit_message(self, qa_output):
49 - msg_prefix = self.msg_prefix()
50 + def get_new_commit_message(self, qa_output, old_message=None):
51 + msg_prefix = old_message or self.msg_prefix()
52 try:
53 editor = os.environ.get("EDITOR")
54 if editor and utilities.editor_is_executable(editor):