1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-02-26 12:12:11 +01:00

- added missing code for 'osc sr -l [ID]'

- allow osc req as shortcut for osc request.
 - allow osc cat with one parameter, if it is a url.
 - core.py:makeurl() now prints the url for educational purposes if osc -v -v
This commit is contained in:
Jürgen Weigert 2009-09-03 17:28:27 +00:00
parent c2cee79679
commit 6babfdf04d
3 changed files with 51 additions and 18 deletions

4
NEWS
View File

@ -3,6 +3,10 @@
- option to download server side generated _service:* files on update - option to download server side generated _service:* files on update
- support for running source services locally. Happens by default on source update - support for running source services locally. Happens by default on source update
and build. and build.
- added missing code for 'osc sr -l [ID]'
- allow osc req as shortcut for osc request.
- allow osc cat with one parameter, if it is a url.
- core.py:makeurl() now prints the url for educational purposes if osc -v -v
0.121.1 0.121.1
- fixed creation of new ~/.oscrc files - fixed creation of new ~/.oscrc files

View File

@ -500,6 +500,8 @@ class Osc(cmdln.Cmdln):
'(primary project where a package is developed)') '(primary project where a package is developed)')
@cmdln.option('-d', '--diff', action='store_true', @cmdln.option('-d', '--diff', action='store_true',
help='show diff only instead of creating the actual request') help='show diff only instead of creating the actual request')
@cmdln.option('-l', '--list', action='store_true',
help='show submitrequests. Same as \'osc req list -M -a -t submit -D 0\'')
@cmdln.alias("sr") @cmdln.alias("sr")
@cmdln.alias("submitreq") @cmdln.alias("submitreq")
@cmdln.alias("submitpac") @cmdln.alias("submitpac")
@ -518,18 +520,29 @@ class Osc(cmdln.Cmdln):
${cmd_option_list} ${cmd_option_list}
""" """
if opts.list:
opts.state = ""
opts.user = ""
opts.all = True
opts.brief = False
opts.unified = False
opts.type = "submit"
opts.mine = True
opts.days = 30
return self.do_request('list', opts, *args)
args = slash_split(args) args = slash_split(args)
# remove this block later again # remove this block later again
oldcmds = ['create', 'list', 'log', 'show', 'decline', 'accept', 'delete', 'revoke'] oldcmds = ['create', 'list', 'log', 'show', 'decline', 'accept', 'delete', 'revoke']
if args and args[0] in oldcmds: if args and args[0] in oldcmds:
print "***********************************************************************" print "************************************************************************"
print "* WARNING: It looks that you are using this command with a *" print "* WARNING: It looks that you are using this command with a *"
print "* deprecated syntax (maybe) ! *" print "* deprecated syntax (maybe) ! *"
print "* Please run \"osc sr --help\" and \"osc req --help\" *" print "* Please run \"osc sr --help\" and \"osc req --help\" *"
print "* to see the new syntax. *" print "* to see the new syntax. *"
print "* E.g. \"osc sr -l\" is shortcut for \"osc req list -M -s all -t submit\" *" print "* E.g. \"osc sr -l\" is shortcut for \"osc req list -M -a -t submit -D 0\" *"
print "***********************************************************************" print "************************************************************************"
if args[0] == 'create': if args[0] == 'create':
args.pop(0) args.pop(0)
else: else:
@ -720,6 +733,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
@cmdln.option('-M', '--mine', action='store_true', @cmdln.option('-M', '--mine', action='store_true',
help='only show requests created by yourself') help='only show requests created by yourself')
@cmdln.alias("rq") @cmdln.alias("rq")
@cmdln.alias("req")
def do_request(self, subcmd, opts, *args): def do_request(self, subcmd, opts, *args):
"""${cmd_name}: Show and modify requests """${cmd_name}: Show and modify requests
@ -731,6 +745,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
osc submitrequest osc submitrequest
osc deleterequest osc deleterequest
osc changedevelrequest osc changedevelrequest
To send low level requests to the buildservice API, use:
osc api
This command has the following sub commands: This command has the following sub commands:
@ -741,7 +757,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
"log" will show the history of the given ID "log" will show the history of the given ID
"show" will show the request itself, and generate a diff for review, if "show" will show the request itself, and generate a diff for review, if
used with the --diff option. used with the --diff option. The keyword show can be ommitted if the ID is numeric.
"decline" will change the request state to "declined" and append a "decline" will change the request state to "declined" and append a
message that you specify with the --message option. message that you specify with the --message option.
@ -759,7 +775,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
usage: usage:
osc request list [-M] [-U USER] [-s state] [-D DAYS] [-t type] [PRJ [PKG]] osc request list [-M] [-U USER] [-s state] [-D DAYS] [-t type] [PRJ [PKG]]
osc request log ID osc request log ID
osc request show [-d] [-b] ID osc request [show] [-d] [-b] ID
osc request accept [-m TEXT] ID osc request accept [-m TEXT] ID
osc request decline [-m TEXT] ID osc request decline [-m TEXT] ID
osc request revoke [-m TEXT] ID osc request revoke [-m TEXT] ID
@ -777,6 +793,9 @@ Please submit there instead, or use --nodevelproject to force direct submission.
'are mutually exclusive.') 'are mutually exclusive.')
# 'req' defaults to 'req list -M -s all' # 'req' defaults to 'req list -M -s all'
if args and args[0].isdigit():
args = [ 'show', args[0] ]
if not args: if not args:
args = [ 'list' ] args = [ 'list' ]
opts.mine = 1 opts.mine = 1
@ -790,8 +809,8 @@ Please submit there instead, or use --nodevelproject to force direct submission.
if not args or args[0] not in cmds: if not args or args[0] not in cmds:
if subcmd == 'req': if subcmd == 'req':
print >>sys.stderr, 'You may want to try "osc api" instead of "osc req".' print >>sys.stderr, 'You may want to try "osc api" instead of "osc req".'
raise oscerr.WrongArgs('Unknown request action. Choose one of %s.' \ raise oscerr.WrongArgs('Unknown request action %s. Choose one of %s.' \
% ', '.join(cmds)) % (args[0],', '.join(cmds)))
cmd = args[0] cmd = args[0]
del args[0] del args[0]
@ -2131,11 +2150,6 @@ Please submit there instead, or use --nodevelproject to force direct submission.
else: else:
raise e raise e
@cmdln.hide(1)
def do_req(self, subcmd, opts, *args):
print "Command req is obsolete. Please use 'osc api'"
sys.exit(1)
@cmdln.alias('r') @cmdln.alias('r')
@cmdln.option('-l', '--last-build', action='store_true', @cmdln.option('-l', '--last-build', action='store_true',
help='show last build results (succeeded/failed/unknown)') help='show last build results (succeeded/failed/unknown)')
@ -3366,11 +3380,23 @@ Please submit there instead, or use --nodevelproject to force direct submission.
Examples: Examples:
osc cat project package file osc cat project package file
osc cat project/package/file osc cat project/package/file
osc cat http://api.opensuse.org/build/.../_log
osc cat http://api.opensuse.org/source/../_link
${cmd_usage} ${cmd_usage}
${cmd_option_list} ${cmd_option_list}
""" """
if len(args) == 1 and (args[0].startswith('http://') or
args[0].startswith('https://')):
opts.method = 'GET'
opts.headers = None
opts.data = None
opts.file = None
return self.do_api('list', opts, *args)
args = slash_split(args) args = slash_split(args)
if len(args) != 3: if len(args) != 3:
raise oscerr.WrongArgs('Wrong number of arguments.') raise oscerr.WrongArgs('Wrong number of arguments.')

View File

@ -5,7 +5,7 @@
# and distributed under the terms of the GNU General Public Licence, # and distributed under the terms of the GNU General Public Licence,
# either version 2, or version 3 (at your option). # either version 2, or version 3 (at your option).
__version__ = '0.122pre' __version__ = '0.122pre.1'
# __store_version__ is to be incremented when the format of the working copy # __store_version__ is to be incremented when the format of the working copy
# "store" changes in an incompatible way. Please add any needed migration # "store" changes in an incompatible way. Please add any needed migration
# functionality to check_store_version(). # functionality to check_store_version().
@ -1730,7 +1730,10 @@ def makeurl(baseurl, l, query=[]):
query = urlencode(query) query = urlencode(query)
scheme, netloc = urlsplit(baseurl)[0:2] scheme, netloc = urlsplit(baseurl)[0:2]
return urlunsplit((scheme, netloc, '/'.join(l), query, '')) u = urlunsplit((scheme, netloc, '/'.join(l), query, ''))
if conf.config['verbose'] > 2:
print "[",u,"]"
return u
def http_request(method, url, headers={}, data=None, file=None, timeout=100): def http_request(method, url, headers={}, data=None, file=None, timeout=100):