From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id D5EE41386F4 for ; Mon, 10 Aug 2015 14:45:01 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 6C4EA142BC; Mon, 10 Aug 2015 14:45:00 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 043E9142BC for ; Mon, 10 Aug 2015 14:44:59 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 2F477340943 for ; Mon, 10 Aug 2015 14:44:59 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 71F2E144 for ; Mon, 10 Aug 2015 14:44:57 +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: <1439217843.46dafadff58da0220511f20480b73ad09f913430.mgorny@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: bin/, pym/repoman/ X-VCS-Repository: proj/portage X-VCS-Files: bin/repoman pym/repoman/utilities.py X-VCS-Directories: bin/ pym/repoman/ X-VCS-Committer: mgorny X-VCS-Committer-Name: Michał Górny X-VCS-Revision: 46dafadff58da0220511f20480b73ad09f913430 X-VCS-Branch: master Date: Mon, 10 Aug 2015 14:44:57 +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: 349d5aa9-3518-4893-9ccd-95ba52f391c1 X-Archives-Hash: fd4ea3c5507ddd663ef9f768148426e6 commit: 46dafadff58da0220511f20480b73ad09f913430 Author: Michał Górny gentoo org> AuthorDate: Mon Aug 10 14:00:40 2015 +0000 Commit: Michał Górny gentoo org> CommitDate: Mon Aug 10 14:44:03 2015 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=46dafadf repoman commit: Prefix commit message template with cat/PN Reviewed-by: Brian Dolbec gentoo.org> bin/repoman | 9 +++++++-- pym/repoman/utilities.py | 7 +++++-- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/bin/repoman b/bin/repoman index 7cb32ce..1ba7841 100755 --- a/bin/repoman +++ b/bin/repoman @@ -2696,16 +2696,21 @@ else: # We've read the content so the file is no longer needed. commitmessagefile = None if not commitmessage or not commitmessage.strip(): + msg_prefix = "" + if repolevel > 1: + msg_prefix = "/".join(reposplit[1:]) + ": " + try: editor = os.environ.get("EDITOR") if editor and utilities.editor_is_executable(editor): commitmessage = utilities.get_commit_message_with_editor( - editor, message=qa_output) + editor, message=qa_output, prefix=msg_prefix) else: commitmessage = utilities.get_commit_message_with_stdin() except KeyboardInterrupt: exithandler() - if not commitmessage or not commitmessage.strip(): + if (not commitmessage or not commitmessage.strip() + or commitmessage.strip() == msg_prefix): print("* no commit message? aborting commit.") sys.exit(1) commitmessage = commitmessage.rstrip() diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py index b9594a7..f2d5fd8 100644 --- a/pym/repoman/utilities.py +++ b/pym/repoman/utilities.py @@ -399,7 +399,7 @@ def editor_is_executable(editor): return os.access(filename, os.X_OK) and os.path.isfile(filename) -def get_commit_message_with_editor(editor, message=None): +def get_commit_message_with_editor(editor, message=None, prefix=""): """ Execute editor with a temporary file as it's argument and return the file content afterwards. @@ -408,13 +408,16 @@ def get_commit_message_with_editor(editor, message=None): @type: string @param message: An iterable of lines to show in the editor. @type: iterable + @param prefix: Suggested prefix for the commit message summary line. + @type: string @rtype: string or None @return: A string on success or None if an error occurs. """ fd, filename = mkstemp() try: os.write(fd, _unicode_encode(_( - "\n# Please enter the commit message " + \ + prefix + + "\n\n# Please enter the commit message " + \ "for your changes.\n# (Comment lines starting " + \ "with '#' will not be included)\n"), encoding=_encodings['content'], errors='backslashreplace'))