mirror of
https://github.com/openSUSE/osc.git
synced 2024-12-25 17:36:13 +01:00
- fixed #113 ("osc creq -s ...")
This commit is contained in:
parent
45bf1945d0
commit
603cf3b713
@ -1331,7 +1331,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
(project, p, t, p, options_block)
|
(project, p, t, p, options_block)
|
||||||
actionxml += s
|
actionxml += s
|
||||||
|
|
||||||
return actionxml
|
return actionxml, []
|
||||||
|
|
||||||
elif len(args) <= 2:
|
elif len(args) <= 2:
|
||||||
# try using the working copy at hand
|
# try using the working copy at hand
|
||||||
@ -1389,7 +1389,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
|
|
||||||
reqs = get_request_list(apiurl, dst_project, dst_package, req_type='submit', req_state=['new', 'review'])
|
reqs = get_request_list(apiurl, dst_project, dst_package, req_type='submit', req_state=['new', 'review'])
|
||||||
user = conf.get_apiurl_usr(apiurl)
|
user = conf.get_apiurl_usr(apiurl)
|
||||||
myreqs = [ i for i in reqs if i.state.who == user ]
|
myreqs = [ i for i in reqs if i.state.who == user and i.reqid != opts.supersede ]
|
||||||
repl = 'y'
|
repl = 'y'
|
||||||
if len(myreqs) > 0 and not opts.yes:
|
if len(myreqs) > 0 and not opts.yes:
|
||||||
print('You already created the following submit request: %s.' % \
|
print('You already created the following submit request: %s.' % \
|
||||||
@ -1398,19 +1398,16 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
if repl.lower() == 'c':
|
if repl.lower() == 'c':
|
||||||
print('Aborting', file=sys.stderr)
|
print('Aborting', file=sys.stderr)
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
elif repl.lower() != 'y':
|
||||||
|
myreqs = []
|
||||||
|
|
||||||
actionxml = """<action type="submit"> <source project="%s" package="%s" rev="%s"/> <target project="%s" package="%s"/> %s </action>""" % \
|
actionxml = """<action type="submit"> <source project="%s" package="%s" rev="%s"/> <target project="%s" package="%s"/> %s </action>""" % \
|
||||||
(src_project, src_package, opts.revision or show_upstream_rev(apiurl, src_project, src_package), dst_project, dst_package, options_block)
|
(src_project, src_package, opts.revision or show_upstream_rev(apiurl, src_project, src_package), dst_project, dst_package, options_block)
|
||||||
if repl.lower() == 'y':
|
|
||||||
for req in myreqs:
|
|
||||||
change_request_state(apiurl, req.reqid, 'superseded',
|
|
||||||
'superseded by %s' % result, result)
|
|
||||||
|
|
||||||
if opts.supersede:
|
if opts.supersede:
|
||||||
change_request_state(apiurl, opts.supersede, 'superseded', '', result)
|
myreqs.append(opts.supersede)
|
||||||
|
|
||||||
#print 'created request id', result
|
#print 'created request id', result
|
||||||
return actionxml
|
return actionxml, myreqs
|
||||||
|
|
||||||
def _delete_request(self, args, opts):
|
def _delete_request(self, args, opts):
|
||||||
if len(args) < 1:
|
if len(args) < 1:
|
||||||
@ -1610,11 +1607,14 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
actionsxml = ""
|
actionsxml = ""
|
||||||
|
supersede = []
|
||||||
for ai in opts.actions:
|
for ai in opts.actions:
|
||||||
if ai == 'submit':
|
if ai == 'submit':
|
||||||
args = opts.actiondata[i]
|
args = opts.actiondata[i]
|
||||||
i = i+1
|
i = i+1
|
||||||
actionsxml += self._submit_request(args, opts, options_block)
|
actions, to_supersede = self._submit_request(args, opts, options_block)
|
||||||
|
actionsxml += actions
|
||||||
|
supersede.extend(to_supersede)
|
||||||
elif ai == 'delete':
|
elif ai == 'delete':
|
||||||
args = opts.actiondata[i]
|
args = opts.actiondata[i]
|
||||||
actionsxml += self._delete_request(args, opts)
|
actionsxml += self._delete_request(args, opts)
|
||||||
@ -1654,7 +1654,11 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
f = http_POST(u, data=xml)
|
f = http_POST(u, data=xml)
|
||||||
|
|
||||||
root = ET.parse(f).getroot()
|
root = ET.parse(f).getroot()
|
||||||
return root.get('id')
|
rid = root.get('id')
|
||||||
|
for srid in supersede:
|
||||||
|
change_request_state(apiurl, srid, 'superseded',
|
||||||
|
'superseded by %s' % rid, rid)
|
||||||
|
return rid
|
||||||
|
|
||||||
|
|
||||||
@cmdln.option('-m', '--message', metavar='TEXT',
|
@cmdln.option('-m', '--message', metavar='TEXT',
|
||||||
|
Loading…
Reference in New Issue
Block a user