don't allow select in an outdated (+7 days) project
and build enable the prj afterwards
This commit is contained in:
parent
ad71b0843b
commit
5fd408c0e1
@ -241,6 +241,9 @@ def do_staging(self, subcmd, opts, *args):
|
|||||||
osclib.accept_command.AcceptCommand(api).perform(api.prj_from_letter(args[1]))
|
osclib.accept_command.AcceptCommand(api).perform(api.prj_from_letter(args[1]))
|
||||||
elif cmd in ['select', 'unselect']:
|
elif cmd in ['select', 'unselect']:
|
||||||
stprj = api.prj_from_letter(args[1])
|
stprj = api.prj_from_letter(args[1])
|
||||||
|
if not api.prj_frozen_enough(stprj):
|
||||||
|
print "Freeze the prj first"
|
||||||
|
return False
|
||||||
for rq in RequestFinder.find_sr(args[2:], opts.apiurl):
|
for rq in RequestFinder.find_sr(args[2:], opts.apiurl):
|
||||||
if cmd == 'select':
|
if cmd == 'select':
|
||||||
api.rq_to_prj(rq, stprj)
|
api.rq_to_prj(rq, stprj)
|
||||||
@ -248,6 +251,8 @@ def do_staging(self, subcmd, opts, *args):
|
|||||||
api.rm_from_prj(stprj, request_id=rq)
|
api.rm_from_prj(stprj, request_id=rq)
|
||||||
api.add_review(rq, by_group='factory-staging',
|
api.add_review(rq, by_group='factory-staging',
|
||||||
msg='Please recheck')
|
msg='Please recheck')
|
||||||
|
api.build_switch_prj(stprj, 'enable')
|
||||||
|
|
||||||
elif cmd in ['move']:
|
elif cmd in ['move']:
|
||||||
cprj = store_read_project(os.getcwd())
|
cprj = store_read_project(os.getcwd())
|
||||||
sprj = api.prj_from_letter(opts.from_) if opts.from_ else cprj
|
sprj = api.prj_from_letter(opts.from_) if opts.from_ else cprj
|
||||||
|
@ -742,3 +742,20 @@ class StagingAPI(object):
|
|||||||
ET.SubElement(prjmeta.find('build'), state)
|
ET.SubElement(prjmeta.find('build'), state)
|
||||||
|
|
||||||
http_PUT(url, data=ET.tostring(prjmeta))
|
http_PUT(url, data=ET.tostring(prjmeta))
|
||||||
|
|
||||||
|
def prj_frozen_enough(self, project):
|
||||||
|
"""
|
||||||
|
Check if we can and should refreeze the prj"
|
||||||
|
:param project the project to check
|
||||||
|
:returns True if we can select into it
|
||||||
|
"""
|
||||||
|
|
||||||
|
data = self.get_prj_pseudometa(project)
|
||||||
|
if data['requests']:
|
||||||
|
return True # already has content
|
||||||
|
|
||||||
|
# young enough
|
||||||
|
if self.days_since_last_freeze(project) < 6.5:
|
||||||
|
return True
|
||||||
|
|
||||||
|
return False
|
||||||
|
Loading…
x
Reference in New Issue
Block a user