Merge lp:~james-w/tarmac/commit-message into lp:~ubuntuone-hackers/tarmac/trunk

Proposed by James Westby
Status: Superseded
Proposed branch: lp:~james-w/tarmac/commit-message
Merge into: lp:~ubuntuone-hackers/tarmac/trunk
Diff against target: 41 lines (+25/-1)
2 files modified
tarmac/plugins/command.py (+1/-1)
tarmac/plugins/commit.py (+24/-0)
To merge this branch: bzr merge lp:~james-w/tarmac/commit-message
Reviewer Review Type Date Requested Status
Ubuntu One hackers Pending
Review via email: mp+140547@code.launchpad.net

This proposal has been superseded by a proposal from 2012-12-18.

Description of the change

Hi,

This adds the commit message plugin that CA used to set the [r=<reviewer>] and [bug=] things.

It might not be needed with the template plugin used by u1.

Thanks,

James

To post a comment you must log in.
lp:~james-w/tarmac/commit-message updated
417. By James Westby

Merged utf8 into commit-message.

418. By James Westby

Merged utf8 into commit-message.

419. By James Westby

Merged utf8 into commit-message.

420. By James Westby

Merged utf8 into commit-message.

421. By James Westby

Remove the commit plugin.

422. By James Westby

Merged utf8 into commit-message.

Unmerged revisions

422. By James Westby

Merged utf8 into commit-message.

421. By James Westby

Remove the commit plugin.

420. By James Westby

Merged utf8 into commit-message.

419. By James Westby

Merged utf8 into commit-message.

418. By James Westby

Merged utf8 into commit-message.

417. By James Westby

Merged utf8 into commit-message.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tarmac/plugins/command.py'
2--- tarmac/plugins/command.py 2012-03-06 19:55:15 +0000
3+++ tarmac/plugins/command.py 2012-12-18 21:20:41 +0000
4@@ -185,7 +185,7 @@
5 u'%(output)s') % {
6 'source': self.proposal.source_branch.display_name,
7 'target': self.proposal.target_branch.display_name,
8- 'output': u'\n'.join([stdout_value, stderr_value]),
9+ 'output': u'\n'.join([stdout_value.decode('utf-8', 'ignore'), stderr_value.decode('utf-8', 'ignore')]),
10 }
11 raise VerifyCommandFailed(message, comment)
12
13
14=== added file 'tarmac/plugins/commit.py'
15--- tarmac/plugins/commit.py 1970-01-01 00:00:00 +0000
16+++ tarmac/plugins/commit.py 2012-12-18 21:20:41 +0000
17@@ -0,0 +1,24 @@
18+import re
19+
20+from tarmac.hooks import tarmac_hooks
21+from tarmac.plugins import TarmacPlugin
22+
23+
24+class CommitMessage(TarmacPlugin):
25+
26+ def run(self, command, target, source, proposal):
27+ if not re.match(r'^\[.+?\].*$', proposal.commit_message):
28+ params = ["[r=%s]" % proposal.reviewer.name]
29+ for bug in proposal.source_branch.linked_bugs:
30+ params.append("[bug=%s]" % bug.id)
31+
32+ proposal.commit_message = ("%s " % ",".join(params) +
33+ proposal.commit_message)
34+ self.logger.debug("Setting commit_message to %s",
35+ proposal.commit_message)
36+ else:
37+ self.logger.debug("%s has already right commit message",
38+ proposal)
39+
40+tarmac_hooks['tarmac_pre_commit'].hook(CommitMessage(),
41+ 'Commit messsage template editor.')

Subscribers

People subscribed via source and target branches