1 |
commit: 4d38fd403a374a07def13421cd276c0b2de84605 |
2 |
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Sep 19 04:34:01 2015 +0000 |
4 |
Commit: Brian Dolbec <dolsen <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Sep 21 23:42:47 2015 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=4d38fd40 |
7 |
|
8 |
repoman/actions.py: Split out get_new_commit_message() |
9 |
|
10 |
pym/repoman/actions.py | 39 ++++++++++++++++++++++----------------- |
11 |
1 file changed, 22 insertions(+), 17 deletions(-) |
12 |
|
13 |
diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py |
14 |
index 4f516da..9d97b20 100644 |
15 |
--- a/pym/repoman/actions.py |
16 |
+++ b/pym/repoman/actions.py |
17 |
@@ -111,24 +111,8 @@ class Actions(object): |
18 |
else: |
19 |
raise |
20 |
if not commitmessage or not commitmessage.strip(): |
21 |
- msg_prefix = "" |
22 |
- if self.scanner.repolevel > 1: |
23 |
- msg_prefix = "/".join(self.scanner.reposplit[1:]) + ": " |
24 |
+ commitmessage = self.get_new_commit_message(qa_output) |
25 |
|
26 |
- try: |
27 |
- editor = os.environ.get("EDITOR") |
28 |
- if editor and utilities.editor_is_executable(editor): |
29 |
- commitmessage = utilities.get_commit_message_with_editor( |
30 |
- editor, message=qa_output, prefix=msg_prefix) |
31 |
- else: |
32 |
- commitmessage = utilities.get_commit_message_with_stdin() |
33 |
- except KeyboardInterrupt: |
34 |
- logging.fatal("Interrupted; exiting...") |
35 |
- sys.exit(1) |
36 |
- if (not commitmessage or not commitmessage.strip() |
37 |
- or commitmessage.strip() == msg_prefix): |
38 |
- print("* no commit message? aborting commit.") |
39 |
- sys.exit(1) |
40 |
commitmessage = commitmessage.rstrip() |
41 |
|
42 |
myupdates, broken_changelog_manifests = self.changelogs( |
43 |
@@ -826,3 +810,24 @@ class Actions(object): |
44 |
portage.writemsg("!!! Disabled FEATURES='sign'\n") |
45 |
self.repo_settings.sign_manifests = False |
46 |
|
47 |
+ |
48 |
+ def get_new_commit_message(self, qa_output): |
49 |
+ msg_prefix = "" |
50 |
+ if self.scanner.repolevel > 1: |
51 |
+ msg_prefix = "/".join(self.scanner.reposplit[1:]) + ": " |
52 |
+ |
53 |
+ try: |
54 |
+ editor = os.environ.get("EDITOR") |
55 |
+ if editor and utilities.editor_is_executable(editor): |
56 |
+ commitmessage = utilities.get_commit_message_with_editor( |
57 |
+ editor, message=qa_output, prefix=msg_prefix) |
58 |
+ else: |
59 |
+ commitmessage = utilities.get_commit_message_with_stdin() |
60 |
+ except KeyboardInterrupt: |
61 |
+ logging.fatal("Interrupted; exiting...") |
62 |
+ sys.exit(1) |
63 |
+ if (not commitmessage or not commitmessage.strip() |
64 |
+ or commitmessage.strip() == msg_prefix): |
65 |
+ print("* no commit message? aborting commit.") |
66 |
+ sys.exit(1) |
67 |
+ return commitmessage |