mirror of
https://github.com/openSUSE/osc.git
synced 2025-02-25 11:42:12 +01:00
Merge branch 'overhaul_do_service' of https://github.com/lethliel/osc
Improve error message in do_service a bit. The old "Too few arguments." was misleading (for instance, if a non-remote command was not executed in a package wc). Note: with the new logic we could also get rid of the "raise oscerr.WrongArgs('Local directory is no package')" statement.
This commit is contained in:
commit
ea8c6e1c45
@ -6956,18 +6956,24 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
args = slash_split(args)
|
args = slash_split(args)
|
||||||
project = package = singleservice = mode = None
|
project = package = singleservice = mode = None
|
||||||
apiurl = self.get_api_url()
|
apiurl = self.get_api_url()
|
||||||
|
remote_commands = ('remoterun', 'rr', 'merge', 'wait')
|
||||||
|
|
||||||
if len(args) < 1:
|
if len(args) < 1:
|
||||||
raise oscerr.WrongArgs('No command given.')
|
raise oscerr.WrongArgs('No command given.')
|
||||||
elif len(args) < 3:
|
elif len(args) < 3:
|
||||||
if is_package_dir(os.curdir):
|
if args[0] in remote_commands:
|
||||||
project = store_read_project(os.curdir)
|
if not is_package_dir(os.curdir):
|
||||||
|
msg = ('Either specify the project and package or execute '
|
||||||
|
'the command in a package working copy.')
|
||||||
|
raise oscerr.WrongArgs(msg)
|
||||||
package = store_read_package(os.curdir)
|
package = store_read_package(os.curdir)
|
||||||
|
project = store_read_project(os.curdir)
|
||||||
else:
|
else:
|
||||||
raise oscerr.WrongArgs('Too few arguments.')
|
# raise an appropriate exception if os.curdir is no package wc
|
||||||
|
store_read_package(os.curdir)
|
||||||
if len(args) == 2:
|
if len(args) == 2:
|
||||||
singleservice = args[1]
|
singleservice = args[1]
|
||||||
elif len(args) == 3 and args[0] in ('remoterun', 'rr', 'merge', 'wait'):
|
elif len(args) == 3 and args[0] in remote_commands:
|
||||||
project = args[1]
|
project = args[1]
|
||||||
package = args[2]
|
package = args[2]
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user