mirror of
https://github.com/openSUSE/osc.git
synced 2025-09-07 21:58:41 +02:00
support OBS 2.1 request diff
This commit is contained in:
@@ -1785,26 +1785,32 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
return request_interactive_review(apiurl, r)
|
||||
else:
|
||||
print r
|
||||
# fixme: will inevitably fail if the given target doesn't exist
|
||||
# FIXME: will inevitably fail if the given target doesn't exist
|
||||
# FIXME: diff should work if there are submit actions anyway
|
||||
if opts.diff and r.actions[0].type != 'submit':
|
||||
raise oscerr.WrongOptions('\'--diff\' is not possible for request type: \'%s\'' % r.actions[0].type)
|
||||
elif opts.diff:
|
||||
try:
|
||||
print server_diff(apiurl,
|
||||
r.actions[0].dst_project, r.actions[0].dst_package, None,
|
||||
r.actions[0].src_project, r.actions[0].src_package, r.actions[0].src_rev, opts.unified, True)
|
||||
# works since OBS 2.1
|
||||
print request_diff(apiurl, reqid)
|
||||
except urllib2.HTTPError, e:
|
||||
if e.code != 400:
|
||||
e.osc_msg = 'Diff not possible'
|
||||
raise e
|
||||
# backward compatiblity: only a recent api/backend supports the missingok parameter
|
||||
# for OBS 2.0 and before
|
||||
try:
|
||||
print server_diff(apiurl,
|
||||
r.actions[0].dst_project, r.actions[0].dst_package, None,
|
||||
r.actions[0].src_project, r.actions[0].src_package, r.actions[0].src_rev, opts.unified, False)
|
||||
r.actions[0].src_project, r.actions[0].src_package, r.actions[0].src_rev, opts.unified, True)
|
||||
except urllib2.HTTPError, e:
|
||||
e.osc_msg = 'Diff not possible'
|
||||
raise
|
||||
if e.code != 400:
|
||||
e.osc_msg = 'Diff not possible'
|
||||
raise e
|
||||
# backward compatiblity: only a recent api/backend supports the missingok parameter
|
||||
try:
|
||||
print server_diff(apiurl,
|
||||
r.actions[0].dst_project, r.actions[0].dst_package, None,
|
||||
r.actions[0].src_project, r.actions[0].src_package, r.actions[0].src_rev, opts.unified, False)
|
||||
except urllib2.HTTPError, e:
|
||||
e.osc_msg = 'Diff not possible'
|
||||
raise
|
||||
|
||||
# checkout
|
||||
elif cmd == 'checkout' or cmd == 'co':
|
||||
|
@@ -3462,6 +3462,13 @@ def server_diff(apiurl,
|
||||
return f.read()
|
||||
|
||||
|
||||
def request_diff(apiurl, reqid):
|
||||
u = makeurl(apiurl, ['request', reqid], query={'cmd': 'diff'} )
|
||||
|
||||
f = http_POST(u)
|
||||
return f.read()
|
||||
|
||||
|
||||
def make_dir(apiurl, project, package, pathname=None, prj_dir=None):
|
||||
"""
|
||||
creates the plain directory structure for a package dir.
|
||||
|
Reference in New Issue
Block a user