Merge lp:~tai271828/checkbox/fix-1327939 into lp:checkbox

Proposed by Taihsiang Ho
Status: Merged
Approved by: Zygmunt Krynicki
Approved revision: 3151
Merged at revision: 3153
Proposed branch: lp:~tai271828/checkbox/fix-1327939
Merge into: lp:checkbox
Diff against target: 46 lines (+10/-0)
1 file modified
plainbox/plainbox/impl/commands/run.py (+10/-0)
To merge this branch: bzr merge lp:~tai271828/checkbox/fix-1327939
Reviewer Review Type Date Requested Status
Zygmunt Krynicki (community) Approve
Review via email: mp+228991@code.launchpad.net

Commit message

add comment action and make the comment string be added in the job result (LP: #1327939)

Description of the change

add comment action and make the comment string be added in the job result (LP: #1327939)

To post a comment you must log in.
Revision history for this message
Zygmunt Krynicki (zyga) wrote :

It seems okay but there's one thing I want to change and another thing I need to check. I'll update this code with one more patch and merge it in.

Revision history for this message
Zygmunt Krynicki (zyga) wrote :

Or... let's merge it and I'll commit on top

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'plainbox/plainbox/impl/commands/run.py'
2--- plainbox/plainbox/impl/commands/run.py 2014-07-22 13:58:51 +0000
3+++ plainbox/plainbox/impl/commands/run.py 2014-07-31 08:29:02 +0000
4@@ -229,6 +229,7 @@
5 def wait_for_interaction_prompt(self, job):
6 return self.pick_action_cmd([
7 Action('', _("press ENTER to continue"), 'run'),
8+ Action('c', _('add a comment'), 'comment'),
9 Action('s', _("skip this job"), 'skip'),
10 Action('q', _("save the session and quit"), 'quit')
11 ])
12@@ -747,6 +748,7 @@
13 ui.finished(job, job_state, job_result)
14
15 def _run_single_job_with_ui_loop(self, job, ui):
16+ comments = ""
17 while True:
18 if job.plugin in ('user-interact', 'user-interact-verify',
19 'user-verify', 'manual'):
20@@ -756,11 +758,18 @@
21 cmd = ui.wait_for_interaction_prompt(job)
22 if cmd == 'run' or cmd is None:
23 job_result = self.runner.run_job(job, self.config, ui)
24+ elif cmd == 'comment':
25+ new_comment = input(self.C.BLUE(
26+ _('Please enter your comments:') + '\n'))
27+ if new_comment:
28+ comments += new_comment + '\n'
29+ continue
30 elif cmd == 'skip':
31 job_result = MemoryJobResult({
32 'outcome': IJobResult.OUTCOME_SKIP,
33 'comments': _("Explicitly skipped before execution")
34 })
35+ if comments != "" : job_result.comments = comments
36 break
37 elif cmd == 'quit':
38 raise SystemExit()
39@@ -769,6 +778,7 @@
40 if (self.is_interactive and
41 job_result.outcome == IJobResult.OUTCOME_UNDECIDED):
42 try:
43+ if comments != "" : job_result.comments = comments
44 job_result = self._interaction_callback(
45 self.runner, job, job_result, self.config)
46 except ReRunJob:

Subscribers

People subscribed via source and target branches