mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-12 23:56:13 +01:00
support request diffing relative to a former request
This commit is contained in:
parent
80c9b6e3df
commit
c568cf7b41
@ -2090,6 +2090,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
|
|
||||||
@cmdln.option('-d', '--diff', action='store_true',
|
@cmdln.option('-d', '--diff', action='store_true',
|
||||||
help='generate a diff')
|
help='generate a diff')
|
||||||
|
@cmdln.option('-S', '--superseded-request', metavar='SUPERSEDED_REQUEST',
|
||||||
|
help='Create the diff relative to a given former request')
|
||||||
@cmdln.option('-u', '--unified', action='store_true',
|
@cmdln.option('-u', '--unified', action='store_true',
|
||||||
help='output the diff in the unified diff format')
|
help='output the diff in the unified diff format')
|
||||||
@cmdln.option('--no-devel', action='store_true',
|
@cmdln.option('--no-devel', action='store_true',
|
||||||
@ -2512,8 +2514,15 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
diff = b''
|
diff = b''
|
||||||
try:
|
try:
|
||||||
# works since OBS 2.1
|
# works since OBS 2.1
|
||||||
diff = request_diff(apiurl, reqid)
|
diff = request_diff(apiurl, reqid, opts.superseded_request)
|
||||||
except HTTPError as e:
|
except HTTPError as e:
|
||||||
|
if e.code == 404:
|
||||||
|
# Any referenced object does not exist, eg. the superseded request
|
||||||
|
root = ET.fromstring(e.read())
|
||||||
|
summary = root.find('summary')
|
||||||
|
print(summary.text, file=sys.stderr)
|
||||||
|
raise oscerr.WrongOptions("Object does not exist")
|
||||||
|
|
||||||
# for OBS 2.0 and before
|
# for OBS 2.0 and before
|
||||||
sr_actions = r.get_actions('submit')
|
sr_actions = r.get_actions('submit')
|
||||||
if not r.get_actions('submit') and not r.get_actions('maintenance_incident') and not r.get_actions('maintenance_release'):
|
if not r.get_actions('submit') and not r.get_actions('maintenance_incident') and not r.get_actions('maintenance_release'):
|
||||||
|
@ -4896,8 +4896,11 @@ def server_diff_noex(apiurl,
|
|||||||
return rdiff
|
return rdiff
|
||||||
|
|
||||||
|
|
||||||
def request_diff(apiurl, reqid):
|
def request_diff(apiurl, reqid, superseded_reqid=None):
|
||||||
u = makeurl(apiurl, ['request', reqid], query={'cmd': 'diff'} )
|
query = {'cmd': 'diff'}
|
||||||
|
if superseded_reqid:
|
||||||
|
query['diff_to_superseded'] = superseded_reqid
|
||||||
|
u = makeurl(apiurl, ['request', reqid], query)
|
||||||
|
|
||||||
f = http_POST(u)
|
f = http_POST(u)
|
||||||
return f.read()
|
return f.read()
|
||||||
|
Loading…
Reference in New Issue
Block a user