1
0
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:
Marcus Huewe 2020-07-07 17:19:38 +02:00
commit ea8c6e1c45

View File

@ -6956,18 +6956,24 @@ Please submit there instead, or use --nodevelproject to force direct submission.
args = slash_split(args)
project = package = singleservice = mode = None
apiurl = self.get_api_url()
remote_commands = ('remoterun', 'rr', 'merge', 'wait')
if len(args) < 1:
raise oscerr.WrongArgs('No command given.')
elif len(args) < 3:
if is_package_dir(os.curdir):
project = store_read_project(os.curdir)
if args[0] in remote_commands:
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)
project = store_read_project(os.curdir)
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:
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]
package = args[2]
else: