Merge lp:~vauxoo/openerp-tools/openerprunbot-custom_sticky_branch-dev-moylop260 into lp:openerp-tools

Proposed by Moisés López - http://www.vauxoo.com
Status: Needs review
Proposed branch: lp:~vauxoo/openerp-tools/openerprunbot-custom_sticky_branch-dev-moylop260
Merge into: lp:openerp-tools
Diff against target: 193 lines (+135/-3)
2 files modified
openerp-runbot/openerprunbot/core.py (+134/-2)
openerp-runbot/openerprunbot/templates/defs.html.mako (+1/-1)
To merge this branch: bzr merge lp:~vauxoo/openerp-tools/openerprunbot-custom_sticky_branch-dev-moylop260
Reviewer Review Type Date Requested Status
OpenERP R&D Team Pending
Review via email: mp+192812@code.launchpad.net

Description of the change

IMP for add custom sticky branch with only named of group branch.
IMP for add merge proposal branch of custom sticky branches.

To post a comment you must log in.
262. By Moisés López - http://www.vauxoo.com

[REF] Add custom sticky branches for server & addons

263. By Moisés López - http://www.vauxoo.com

[IMP] Add runbot group branch for Merge Proposal of sticky branches (only web) ToDo: Server & addons

264. By Moisés López - http://www.vauxoo.com

[IMP] Add runbot group branch for Merge Proposal of sticky branches (now addons & server)

265. By Moisés López - http://www.vauxoo.com

[FIX] Add process comma modules with stickty branches

266. By Moisés López - http://www.vauxoo.com

[REF] Refactory to extract merge proposal number

267. By Moisés López - http://www.vauxoo.com

[REF] Add modules to install if merge proposal modify a module plus modules is set

268. By Moisés López - http://www.vauxoo.com

[REF] Add last MP numbers

269. By Moisés López - http://www.vauxoo.com

[REF] Add reason_ok to particular branch

270. By Moisés López - http://www.vauxoo.com

[FIX] Variable not assigned

271. By Moisés López - http://www.vauxoo.com

[REF] Add reason_ok to sticky branches

Unmerged revisions

271. By Moisés López - http://www.vauxoo.com

[REF] Add reason_ok to sticky branches

270. By Moisés López - http://www.vauxoo.com

[FIX] Variable not assigned

269. By Moisés López - http://www.vauxoo.com

[REF] Add reason_ok to particular branch

268. By Moisés López - http://www.vauxoo.com

[REF] Add last MP numbers

267. By Moisés López - http://www.vauxoo.com

[REF] Add modules to install if merge proposal modify a module plus modules is set

266. By Moisés López - http://www.vauxoo.com

[REF] Refactory to extract merge proposal number

265. By Moisés López - http://www.vauxoo.com

[FIX] Add process comma modules with stickty branches

264. By Moisés López - http://www.vauxoo.com

[IMP] Add runbot group branch for Merge Proposal of sticky branches (now addons & server)

263. By Moisés López - http://www.vauxoo.com

[IMP] Add runbot group branch for Merge Proposal of sticky branches (only web) ToDo: Server & addons

262. By Moisés López - http://www.vauxoo.com

[REF] Add custom sticky branches for server & addons

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'openerp-runbot/openerprunbot/core.py'
2--- openerp-runbot/openerprunbot/core.py 2013-10-06 13:33:20 +0000
3+++ openerp-runbot/openerprunbot/core.py 2013-10-29 19:09:28 +0000
4@@ -84,6 +84,7 @@
5 self.committer_name = None
6 self.committer_xgram = None
7 self.committer_email = None
8+ self.reason_ok = False
9
10 def age(self):
11 return time.time()-int(self.local_date_last_modified.strftime("%s"))
12@@ -97,6 +98,8 @@
13 if self.trigger_build:
14 name = self.project_name
15 self.group.need_run_reason.append(name)
16+ self.group.set_reason_ok( False, False )
17+ self.group.set_reason_ok( branch.unique_name, True )
18
19 #----------------------------------------------------------
20 # OpenERP RunBot Grouped Branch
21@@ -199,7 +202,8 @@
22 # Don't change stickiness for the hard-coded branches.
23 return
24 previous = self.sticky
25- self.sticky = state.get(self.team_name, {}).get(self.name, {}).get('sticky', False)
26+ default_sticky = "stick" in self.name
27+ self.sticky = state.get(self.team_name, {}).get(self.name, {}).get('sticky', default_sticky)
28 if self.sticky != previous:
29 log("stickiness changed", team=self.team_name, branch=self.name, now=self.sticky)
30
31@@ -317,6 +321,12 @@
32 elif not self.addons[0].trigger_build:
33 b = self.runbot.main_branches['addons'+ending]
34 self.addons[0].update_launchpad(b)
35+
36+ def set_reason_ok(self, unique_name, reason_ok):
37+ #unique_name=False set all reason_ok
38+ for branch in self.all_branches():
39+ if branch and (branch.unique_name == unique_name or not unique_name):
40+ branch.reason_ok = reason_ok
41
42 #----------------------------------------------------------
43 # OpenERP RunBot Engine
44@@ -506,7 +516,8 @@
45 if self.quit: return
46 for name, c in v.items():
47 if not name: continue
48- g = RunBotGroupedBranch(self, team, name, c['version'], 0,
49+ default_sticky = 'stick' in name
50+ g = RunBotGroupedBranch(self, team, name, c['version'], default_sticky,
51 server_branch=c['server_branch'],
52 client_web_branch=c.get('client_web_branch'),
53 web_branch=c.get('web_branch'),
54@@ -575,6 +586,127 @@
55 if self.quit: return []
56 if not g.configured:
57 g.add_main_branches()
58+ if 'stick' in g.name:
59+ if g.web_branch:
60+ log("launchpad update custom sticky web branch " + g.web_branch)
61+ b = g.runbot.launchpad.get_branch(unique_name = g.web_branch)
62+ if not b:
63+ log("WARNING:no such unique name", name = g.web_branch)
64+ else:
65+ g.web.update_launchpad( b )
66+ #Start check Merge Proposal##TODO: IMP this for generate a new function
67+ filters = {'status': NEW_MERGE_STATUS}
68+ merge_proposals = b.getMergeProposals(**filters)#TODO: IMP this for extract more recent MP (-2 months) with params merge_proposal.date_created
69+ mp_number__mp_obj = dict([(merge_proposal.web_link.split('/')[-1], merge_proposal) for merge_proposal in merge_proposals])
70+ mp_numbers_sort = sorted( mp_number__mp_obj.keys(), reverse=True )
71+ for mp_number in mp_numbers_sort[:15]:#last MP
72+ merge_proposal = mp_number__mp_obj[ mp_number ]
73+ new_web_branch = merge_proposal.source_branch.unique_name
74+ new_name = g.name.replace('sticky', '').replace('stick', '') + '-web-mp-'+mp_number
75+ if (g.team_name, new_name) not in self.groups:
76+ new_rbgb = RunBotGroupedBranch(self, g.team_name, new_name, g.version, 0,
77+ server_branch=g.server_branch,
78+ client_web_branch=new_web_branch,#g.web_branch,
79+ web_branch=new_web_branch,#g.web_branch,
80+ addons_branches=g.addons_branches,
81+ modules = ','.join( g.modules ), job_type=g.job_type)
82+
83+ new_rbgb.configure_branches(self.launchpad)
84+ new_rbgb.set_reason_ok(new_web_branch, True)
85+
86+ if new_rbgb.is_ok():
87+ log("adding configured group", team=new_rbgb.team_name, name=new_name)
88+ self.groups[(new_rbgb.team_name, new_name)] = new_rbgb
89+ else:
90+ log("WARNING: misconfigured group", team=new_rbgb.team_name, name=new_name)
91+ #End check Merge Proposal
92+ if g.server_branch:
93+ log("launchpad update custom sticky server branch " + g.server_branch)
94+ b = g.runbot.launchpad.get_branch(unique_name = g.server_branch)
95+ if not b:
96+ log("WARNING:no such unique name", name = g.server_branch)
97+ else:
98+ g.server.update_launchpad( b )
99+
100+ #Start check Merge Proposal##TODO: IMP this for generate a new function
101+ filters = {'status': NEW_MERGE_STATUS}
102+ merge_proposals = b.getMergeProposals(**filters)#TODO: IMP this for extract more recent MP (-2 months) with params merge_proposal.date_created
103+
104+ mp_number__mp_obj = dict([(merge_proposal.web_link.split('/')[-1], merge_proposal) for merge_proposal in merge_proposals])
105+ mp_numbers_sort = sorted( mp_number__mp_obj.keys(), reverse=True )
106+ for mp_number in mp_numbers_sort[:15]:#last MP
107+ merge_proposal = mp_number__mp_obj[ mp_number ]
108+ new_server_branch = merge_proposal.source_branch.unique_name
109+ new_name = g.name.replace('sticky', '').replace('stick', '') + '-server-mp-'+mp_number
110+ if (g.team_name, new_name) not in self.groups:
111+ new_rbgb = RunBotGroupedBranch(self, g.team_name, new_name, g.version, 0,
112+ server_branch=new_server_branch,
113+ client_web_branch=g.web_branch,
114+ web_branch=g.web_branch,
115+ addons_branches=g.addons_branches,
116+ modules = ','.join( g.modules ), job_type=g.job_type)
117+
118+ new_rbgb.configure_branches(self.launchpad)
119+ new_rbgb.set_reason_ok(new_server_branch, True)
120+
121+ if new_rbgb.is_ok():
122+ log("adding configured group", team=new_rbgb.team_name, name=new_name)
123+ self.groups[(new_rbgb.team_name, new_name)] = new_rbgb
124+ else:
125+ log("WARNING: misconfigured group", team=new_rbgb.team_name, name=new_name)
126+ #End check Merge Proposal
127+ if g.addons:
128+ for addon_rb in g.addons:
129+ log("launchpad update custom sticky addons branch " + addon_rb.unique_name)
130+ b = g.runbot.launchpad.get_branch(unique_name = addon_rb.unique_name)
131+ if not b:
132+ log("WARNING:no such unique name", name = addon_rb.unique_name)
133+ else:
134+ addon_rb.update_launchpad( b )
135+
136+
137+ #Start check Merge Proposal##TODO: IMP this for generate a new function
138+ filters = {'status': NEW_MERGE_STATUS}
139+ merge_proposals = b.getMergeProposals(**filters)#TODO: IMP this for extract more recent MP (-2 months) with params merge_proposal.date_created
140+ mp_number__mp_obj = dict([(merge_proposal.web_link.split('/')[-1], merge_proposal) for merge_proposal in merge_proposals])
141+ mp_numbers_sort = sorted( mp_number__mp_obj.keys(), reverse=True )
142+ for mp_number in mp_numbers_sort[:15]:#last MP
143+ merge_proposal = mp_number__mp_obj[ mp_number ]
144+ new_addon_branch = merge_proposal.source_branch.unique_name
145+ new_name = g.name.replace('sticky', '').replace('stick', '') + '-addons-mp-'+mp_number
146+ if (g.team_name, new_name) not in self.groups:
147+ new_addons_branches = []
148+ for old_addon_branch in g.addons_branches:
149+ if old_addon_branch == addon_rb.unique_name:
150+ unique_name_reason = new_addon_branch
151+ new_addons_branches.append( new_addon_branch )
152+ else:
153+ new_addons_branches.append( old_addon_branch )
154+ new_modules = ','.join( g.modules )
155+ if new_modules:
156+ if not '!' in new_modules:#"!" is for exclude modules. I dont need exclude modules.
157+ #Check mp diff for add new modules
158+ preview_diff = merge_proposal.preview_diff
159+ modules_diff_list = [fname_diff.split('/')[0] for fname_diff in preview_diff.diffstat.keys() ]
160+ modules_diff_list = list( set( modules_diff_list ) )
161+ modules_diff_str = ','.join( modules_diff_list )
162+ if modules_diff_str:
163+ new_modules += ',' + modules_diff_str
164+ new_rbgb = RunBotGroupedBranch(self, g.team_name, new_name, g.version, 0,
165+ server_branch=g.server_branch,
166+ client_web_branch=g.web_branch,
167+ web_branch=g.web_branch,
168+ addons_branches=new_addons_branches,
169+ modules = new_modules, job_type=g.job_type)
170+ new_rbgb.configure_branches(self.launchpad)
171+ new_rbgb.set_reason_ok(unique_name_reason, True)
172+
173+ if new_rbgb.is_ok():
174+ log("adding configured group", team=new_rbgb.team_name, name=new_name)
175+ self.groups[(new_rbgb.team_name, new_name)] = new_rbgb
176+ else:
177+ log("WARNING: misconfigured group", team=new_rbgb.team_name, name=new_name)
178+ #End check Merge Proposal
179
180 self.checked_date_last_modified = max(x.lp_date_last_modified() for x in self.groups.values())
181 self.assign_positions()
182
183=== modified file 'openerp-runbot/openerprunbot/templates/defs.html.mako'
184--- openerp-runbot/openerprunbot/templates/defs.html.mako 2013-10-03 15:17:46 +0000
185+++ openerp-runbot/openerprunbot/templates/defs.html.mako 2013-10-29 19:09:28 +0000
186@@ -1,6 +1,6 @@
187 <%def name="rev_(r,g,b,p)">
188 <li>
189-% if b.project_name in p.need_run_reason:
190+% if (b.project_name in p.need_run_reason and False) or b.reason_ok:
191 <span class="reason">
192 % else:
193 <span>