1 |
--- |
2 |
bin/repoman | 9 +++++++-- |
3 |
pym/repoman/utilities.py | 7 +++++-- |
4 |
2 files changed, 12 insertions(+), 4 deletions(-) |
5 |
|
6 |
diff --git a/bin/repoman b/bin/repoman |
7 |
index 7cb32ce..1ba7841 100755 |
8 |
--- a/bin/repoman |
9 |
+++ b/bin/repoman |
10 |
@@ -2696,16 +2696,21 @@ else: |
11 |
# We've read the content so the file is no longer needed. |
12 |
commitmessagefile = None |
13 |
if not commitmessage or not commitmessage.strip(): |
14 |
+ msg_prefix = "" |
15 |
+ if repolevel > 1: |
16 |
+ msg_prefix = "/".join(reposplit[1:]) + ": " |
17 |
+ |
18 |
try: |
19 |
editor = os.environ.get("EDITOR") |
20 |
if editor and utilities.editor_is_executable(editor): |
21 |
commitmessage = utilities.get_commit_message_with_editor( |
22 |
- editor, message=qa_output) |
23 |
+ editor, message=qa_output, prefix=msg_prefix) |
24 |
else: |
25 |
commitmessage = utilities.get_commit_message_with_stdin() |
26 |
except KeyboardInterrupt: |
27 |
exithandler() |
28 |
- if not commitmessage or not commitmessage.strip(): |
29 |
+ if (not commitmessage or not commitmessage.strip() |
30 |
+ or commitmessage.strip() == msg_prefix): |
31 |
print("* no commit message? aborting commit.") |
32 |
sys.exit(1) |
33 |
commitmessage = commitmessage.rstrip() |
34 |
diff --git a/pym/repoman/utilities.py b/pym/repoman/utilities.py |
35 |
index b9594a7..f2d5fd8 100644 |
36 |
--- a/pym/repoman/utilities.py |
37 |
+++ b/pym/repoman/utilities.py |
38 |
@@ -399,7 +399,7 @@ def editor_is_executable(editor): |
39 |
return os.access(filename, os.X_OK) and os.path.isfile(filename) |
40 |
|
41 |
|
42 |
-def get_commit_message_with_editor(editor, message=None): |
43 |
+def get_commit_message_with_editor(editor, message=None, prefix=""): |
44 |
""" |
45 |
Execute editor with a temporary file as it's argument |
46 |
and return the file content afterwards. |
47 |
@@ -408,13 +408,16 @@ def get_commit_message_with_editor(editor, message=None): |
48 |
@type: string |
49 |
@param message: An iterable of lines to show in the editor. |
50 |
@type: iterable |
51 |
+ @param prefix: Suggested prefix for the commit message summary line. |
52 |
+ @type: string |
53 |
@rtype: string or None |
54 |
@return: A string on success or None if an error occurs. |
55 |
""" |
56 |
fd, filename = mkstemp() |
57 |
try: |
58 |
os.write(fd, _unicode_encode(_( |
59 |
- "\n# Please enter the commit message " + \ |
60 |
+ prefix + |
61 |
+ "\n\n# Please enter the commit message " + \ |
62 |
"for your changes.\n# (Comment lines starting " + \ |
63 |
"with '#' will not be included)\n"), |
64 |
encoding=_encodings['content'], errors='backslashreplace')) |
65 |
-- |
66 |
2.5.0 |