mirror of
https://github.com/openSUSE/osc.git
synced 2024-11-12 23:56:13 +01:00
support OBS 2.1 request diff
This commit is contained in:
parent
b718669685
commit
e5016d0f64
4
NEWS
4
NEWS
@ -1,5 +1,9 @@
|
||||
0.130
|
||||
- New "service" command to run source services locally or trigger a re-run on the server.
|
||||
#
|
||||
# Feature which requires OBS 2.1
|
||||
#
|
||||
- support reliable diff for an accepted request
|
||||
|
||||
0.129
|
||||
- "dists" command to show the configured default base repos from the server.
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user