Merge lp:~dobey/tarmac/merge-hooks into lp:tarmac

Proposed by dobey
Status: Merged
Approved by: Paul Hummer
Approved revision: 307
Merged at revision: 322
Proposed branch: lp:~dobey/tarmac/merge-hooks
Merge into: lp:tarmac
Diff against target: 55 lines (+22/-2)
2 files modified
tarmac/bin/commands.py (+9/-0)
tarmac/hooks.py (+13/-2)
To merge this branch: bzr merge lp:~dobey/tarmac/merge-hooks
Reviewer Review Type Date Requested Status
Paul Hummer Approve
Review via email: mp+30442@code.launchpad.net

Commit message

Add hooks for before and after all the merges for a branch are done
Fix the introduced values in the pre/post-commit hooks to match Tarmac versioning

To post a comment you must log in.
lp:~dobey/tarmac/merge-hooks updated
307. By dobey

Need to pass target instead of branch_url to the hook, so we can get config

Revision history for this message
Paul Hummer (rockstar) wrote :

Maybe for these hooks, you could also pass it a list of proposals that were landed. What do you think?

review: Needs Information
Revision history for this message
Paul Hummer (rockstar) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'tarmac/bin/commands.py'
2--- tarmac/bin/commands.py 2010-07-18 18:22:22 +0000
3+++ tarmac/bin/commands.py 2010-07-20 18:22:42 +0000
4@@ -128,6 +128,11 @@
5 return
6
7 target = Branch.create(lp_branch, self.config, create_tree=True)
8+
9+ self.logger.debug('Firing tarmac_pre_merge hook')
10+ tarmac_hooks['tarmac_pre_merge'].fire(
11+ self, target)
12+
13 try:
14 for proposal in proposals:
15
16@@ -208,6 +213,10 @@
17 self, target, source, proposal)
18
19 target.cleanup()
20+ else:
21+ self.logger.debug('Firing tarmac_post_merge hook')
22+ tarmac_hooks['tarmac_post_merge'].fire(
23+ self, target)
24 finally:
25 target.cleanup()
26
27
28=== modified file 'tarmac/hooks.py'
29--- tarmac/hooks.py 2010-04-24 01:38:43 +0000
30+++ tarmac/hooks.py 2010-07-20 18:22:42 +0000
31@@ -42,11 +42,22 @@
32 self.create_hook(TarmacHookPoint('tarmac_pre_commit',
33 'Called right after Tarmac checks out and merges in a new '
34 'branch, but before committing.',
35- (1, 14, 0), False))
36+ (0, 2), False))
37
38 self.create_hook(TarmacHookPoint('tarmac_post_commit',
39 'Called right after Tarmac commits the merged revision',
40- (1, 14, 0), False))
41+ (0, 2), False))
42+
43+ self.create_hook(TarmacHookPoint('tarmac_pre_merge',
44+ 'Called right before tarmac begins attempting to merge '
45+ 'approved branches into the target branch.',
46+ (0, 3, 3), False))
47+
48+ self.create_hook(TarmacHookPoint('tarmac_post_merge',
49+ 'Called right after Tarmac finishes merging approved '
50+ 'branches into the target branch.',
51+ (0, 3, 3), False))
52+
53
54
55 tarmac_hooks = TarmacHookRegistry()

Subscribers

People subscribed via source and target branches