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
=== modified file 'openerp-runbot/openerprunbot/core.py'
--- openerp-runbot/openerprunbot/core.py 2013-10-06 13:33:20 +0000
+++ openerp-runbot/openerprunbot/core.py 2013-10-29 19:09:28 +0000
@@ -84,6 +84,7 @@
84 self.committer_name = None84 self.committer_name = None
85 self.committer_xgram = None85 self.committer_xgram = None
86 self.committer_email = None86 self.committer_email = None
87 self.reason_ok = False
8788
88 def age(self):89 def age(self):
89 return time.time()-int(self.local_date_last_modified.strftime("%s"))90 return time.time()-int(self.local_date_last_modified.strftime("%s"))
@@ -97,6 +98,8 @@
97 if self.trigger_build:98 if self.trigger_build:
98 name = self.project_name99 name = self.project_name
99 self.group.need_run_reason.append(name)100 self.group.need_run_reason.append(name)
101 self.group.set_reason_ok( False, False )
102 self.group.set_reason_ok( branch.unique_name, True )
100103
101#----------------------------------------------------------104#----------------------------------------------------------
102# OpenERP RunBot Grouped Branch105# OpenERP RunBot Grouped Branch
@@ -199,7 +202,8 @@
199 # Don't change stickiness for the hard-coded branches.202 # Don't change stickiness for the hard-coded branches.
200 return203 return
201 previous = self.sticky204 previous = self.sticky
202 self.sticky = state.get(self.team_name, {}).get(self.name, {}).get('sticky', False)205 default_sticky = "stick" in self.name
206 self.sticky = state.get(self.team_name, {}).get(self.name, {}).get('sticky', default_sticky)
203 if self.sticky != previous:207 if self.sticky != previous:
204 log("stickiness changed", team=self.team_name, branch=self.name, now=self.sticky)208 log("stickiness changed", team=self.team_name, branch=self.name, now=self.sticky)
205209
@@ -317,6 +321,12 @@
317 elif not self.addons[0].trigger_build:321 elif not self.addons[0].trigger_build:
318 b = self.runbot.main_branches['addons'+ending]322 b = self.runbot.main_branches['addons'+ending]
319 self.addons[0].update_launchpad(b)323 self.addons[0].update_launchpad(b)
324
325 def set_reason_ok(self, unique_name, reason_ok):
326 #unique_name=False set all reason_ok
327 for branch in self.all_branches():
328 if branch and (branch.unique_name == unique_name or not unique_name):
329 branch.reason_ok = reason_ok
320330
321#----------------------------------------------------------331#----------------------------------------------------------
322# OpenERP RunBot Engine332# OpenERP RunBot Engine
@@ -506,7 +516,8 @@
506 if self.quit: return516 if self.quit: return
507 for name, c in v.items():517 for name, c in v.items():
508 if not name: continue518 if not name: continue
509 g = RunBotGroupedBranch(self, team, name, c['version'], 0,519 default_sticky = 'stick' in name
520 g = RunBotGroupedBranch(self, team, name, c['version'], default_sticky,
510 server_branch=c['server_branch'],521 server_branch=c['server_branch'],
511 client_web_branch=c.get('client_web_branch'),522 client_web_branch=c.get('client_web_branch'),
512 web_branch=c.get('web_branch'),523 web_branch=c.get('web_branch'),
@@ -575,6 +586,127 @@
575 if self.quit: return []586 if self.quit: return []
576 if not g.configured:587 if not g.configured:
577 g.add_main_branches()588 g.add_main_branches()
589 if 'stick' in g.name:
590 if g.web_branch:
591 log("launchpad update custom sticky web branch " + g.web_branch)
592 b = g.runbot.launchpad.get_branch(unique_name = g.web_branch)
593 if not b:
594 log("WARNING:no such unique name", name = g.web_branch)
595 else:
596 g.web.update_launchpad( b )
597 #Start check Merge Proposal##TODO: IMP this for generate a new function
598 filters = {'status': NEW_MERGE_STATUS}
599 merge_proposals = b.getMergeProposals(**filters)#TODO: IMP this for extract more recent MP (-2 months) with params merge_proposal.date_created
600 mp_number__mp_obj = dict([(merge_proposal.web_link.split('/')[-1], merge_proposal) for merge_proposal in merge_proposals])
601 mp_numbers_sort = sorted( mp_number__mp_obj.keys(), reverse=True )
602 for mp_number in mp_numbers_sort[:15]:#last MP
603 merge_proposal = mp_number__mp_obj[ mp_number ]
604 new_web_branch = merge_proposal.source_branch.unique_name
605 new_name = g.name.replace('sticky', '').replace('stick', '') + '-web-mp-'+mp_number
606 if (g.team_name, new_name) not in self.groups:
607 new_rbgb = RunBotGroupedBranch(self, g.team_name, new_name, g.version, 0,
608 server_branch=g.server_branch,
609 client_web_branch=new_web_branch,#g.web_branch,
610 web_branch=new_web_branch,#g.web_branch,
611 addons_branches=g.addons_branches,
612 modules = ','.join( g.modules ), job_type=g.job_type)
613
614 new_rbgb.configure_branches(self.launchpad)
615 new_rbgb.set_reason_ok(new_web_branch, True)
616
617 if new_rbgb.is_ok():
618 log("adding configured group", team=new_rbgb.team_name, name=new_name)
619 self.groups[(new_rbgb.team_name, new_name)] = new_rbgb
620 else:
621 log("WARNING: misconfigured group", team=new_rbgb.team_name, name=new_name)
622 #End check Merge Proposal
623 if g.server_branch:
624 log("launchpad update custom sticky server branch " + g.server_branch)
625 b = g.runbot.launchpad.get_branch(unique_name = g.server_branch)
626 if not b:
627 log("WARNING:no such unique name", name = g.server_branch)
628 else:
629 g.server.update_launchpad( b )
630
631 #Start check Merge Proposal##TODO: IMP this for generate a new function
632 filters = {'status': NEW_MERGE_STATUS}
633 merge_proposals = b.getMergeProposals(**filters)#TODO: IMP this for extract more recent MP (-2 months) with params merge_proposal.date_created
634
635 mp_number__mp_obj = dict([(merge_proposal.web_link.split('/')[-1], merge_proposal) for merge_proposal in merge_proposals])
636 mp_numbers_sort = sorted( mp_number__mp_obj.keys(), reverse=True )
637 for mp_number in mp_numbers_sort[:15]:#last MP
638 merge_proposal = mp_number__mp_obj[ mp_number ]
639 new_server_branch = merge_proposal.source_branch.unique_name
640 new_name = g.name.replace('sticky', '').replace('stick', '') + '-server-mp-'+mp_number
641 if (g.team_name, new_name) not in self.groups:
642 new_rbgb = RunBotGroupedBranch(self, g.team_name, new_name, g.version, 0,
643 server_branch=new_server_branch,
644 client_web_branch=g.web_branch,
645 web_branch=g.web_branch,
646 addons_branches=g.addons_branches,
647 modules = ','.join( g.modules ), job_type=g.job_type)
648
649 new_rbgb.configure_branches(self.launchpad)
650 new_rbgb.set_reason_ok(new_server_branch, True)
651
652 if new_rbgb.is_ok():
653 log("adding configured group", team=new_rbgb.team_name, name=new_name)
654 self.groups[(new_rbgb.team_name, new_name)] = new_rbgb
655 else:
656 log("WARNING: misconfigured group", team=new_rbgb.team_name, name=new_name)
657 #End check Merge Proposal
658 if g.addons:
659 for addon_rb in g.addons:
660 log("launchpad update custom sticky addons branch " + addon_rb.unique_name)
661 b = g.runbot.launchpad.get_branch(unique_name = addon_rb.unique_name)
662 if not b:
663 log("WARNING:no such unique name", name = addon_rb.unique_name)
664 else:
665 addon_rb.update_launchpad( b )
666
667
668 #Start check Merge Proposal##TODO: IMP this for generate a new function
669 filters = {'status': NEW_MERGE_STATUS}
670 merge_proposals = b.getMergeProposals(**filters)#TODO: IMP this for extract more recent MP (-2 months) with params merge_proposal.date_created
671 mp_number__mp_obj = dict([(merge_proposal.web_link.split('/')[-1], merge_proposal) for merge_proposal in merge_proposals])
672 mp_numbers_sort = sorted( mp_number__mp_obj.keys(), reverse=True )
673 for mp_number in mp_numbers_sort[:15]:#last MP
674 merge_proposal = mp_number__mp_obj[ mp_number ]
675 new_addon_branch = merge_proposal.source_branch.unique_name
676 new_name = g.name.replace('sticky', '').replace('stick', '') + '-addons-mp-'+mp_number
677 if (g.team_name, new_name) not in self.groups:
678 new_addons_branches = []
679 for old_addon_branch in g.addons_branches:
680 if old_addon_branch == addon_rb.unique_name:
681 unique_name_reason = new_addon_branch
682 new_addons_branches.append( new_addon_branch )
683 else:
684 new_addons_branches.append( old_addon_branch )
685 new_modules = ','.join( g.modules )
686 if new_modules:
687 if not '!' in new_modules:#"!" is for exclude modules. I dont need exclude modules.
688 #Check mp diff for add new modules
689 preview_diff = merge_proposal.preview_diff
690 modules_diff_list = [fname_diff.split('/')[0] for fname_diff in preview_diff.diffstat.keys() ]
691 modules_diff_list = list( set( modules_diff_list ) )
692 modules_diff_str = ','.join( modules_diff_list )
693 if modules_diff_str:
694 new_modules += ',' + modules_diff_str
695 new_rbgb = RunBotGroupedBranch(self, g.team_name, new_name, g.version, 0,
696 server_branch=g.server_branch,
697 client_web_branch=g.web_branch,
698 web_branch=g.web_branch,
699 addons_branches=new_addons_branches,
700 modules = new_modules, job_type=g.job_type)
701 new_rbgb.configure_branches(self.launchpad)
702 new_rbgb.set_reason_ok(unique_name_reason, True)
703
704 if new_rbgb.is_ok():
705 log("adding configured group", team=new_rbgb.team_name, name=new_name)
706 self.groups[(new_rbgb.team_name, new_name)] = new_rbgb
707 else:
708 log("WARNING: misconfigured group", team=new_rbgb.team_name, name=new_name)
709 #End check Merge Proposal
578710
579 self.checked_date_last_modified = max(x.lp_date_last_modified() for x in self.groups.values())711 self.checked_date_last_modified = max(x.lp_date_last_modified() for x in self.groups.values())
580 self.assign_positions()712 self.assign_positions()
581713
=== modified file 'openerp-runbot/openerprunbot/templates/defs.html.mako'
--- openerp-runbot/openerprunbot/templates/defs.html.mako 2013-10-03 15:17:46 +0000
+++ openerp-runbot/openerprunbot/templates/defs.html.mako 2013-10-29 19:09:28 +0000
@@ -1,6 +1,6 @@
1<%def name="rev_(r,g,b,p)">1<%def name="rev_(r,g,b,p)">
2 <li>2 <li>
3% if b.project_name in p.need_run_reason:3% if (b.project_name in p.need_run_reason and False) or b.reason_ok:
4 <span class="reason">4 <span class="reason">
5% else:5% else:
6 <span>6 <span>