Add switch wether to commit to Factory or not during accept.

This commit is contained in:
Tomáš Chvátal 2014-03-04 12:58:04 +01:00
parent 9bbe7fca71
commit 220f842c5d
2 changed files with 11 additions and 4 deletions

View File

@ -127,6 +127,8 @@ def _staging_submit_devel(self, project, opts):
return
@cmdln.option('-c', '--commit', action='store_true',
help='accept the request completely and commit the changes to the openSUSE:Factory')
@cmdln.option('-e', '--everything', action='store_true',
help='during check do not stop on first first issue and show them all')
@cmdln.option('-p', '--parent', metavar='TARGETPROJECT',
@ -171,7 +173,7 @@ def do_staging(self, subcmd, opts, *args):
osc staging list
osc staging select [--move [-from PROJECT]] LETTER REQUEST...
osc staging unselect LETTER REQUEST...
osc staging accept LETTER
osc staging accept [--commit] LETTER
osc staging cleanup_rings
"""
if opts.version:
@ -254,7 +256,7 @@ def do_staging(self, subcmd, opts, *args):
for prj in args[1:]:
osclib.freeze_command.FreezeCommand(api).perform(api. prj_from_letter(prj))
elif cmd == 'accept':
return AcceptCommand(api).perform(api. prj_from_letter(args[1]))
return AcceptCommand(api).perform(api. prj_from_letter(args[1]), opts.commit)
elif cmd == 'unselect':
tprj = api.prj_from_letter(args[1]) # see issue 1784
for rq, rq_prj in RequestFinder.find_sr(args[2:], opts.apiurl).items():

View File

@ -5,11 +5,12 @@ class AcceptCommand:
def __init__(self, api):
self.api = api
def perform(self, project):
def perform(self, project, commit):
"""
Accept the staging LETTER for review and submit to factory
Then disable the build to disabled
:param project: staging project we are working with
:param commit: switch wether to commit the pkgs to factory right away or not
"""
status = self.api.check_project_status(project)
@ -25,6 +26,10 @@ class AcceptCommand:
requests.append(req['id'])
for req in requests:
change_request_state(self.api.apiurl, str(req), 'accepted', message='Accept to factory')
# If we are not doing direct commit print out commands needed to accept it
if commit:
change_request_state(self.api.apiurl, str(req), 'accepted', message='Accept to factory')
else:
print('osc rq accept -m "Accept to factory" {}'.format(req))
self.api.build_switch_prj(project, 'disable')