From f2f80a1498c9063c70b9bf0f74a971890000aafb Mon Sep 17 00:00:00 2001 From: lethliel Date: Thu, 2 Jul 2020 09:13:45 +0200 Subject: [PATCH] fix error message if osc service not in cwd fix the error message if osc servce is run without [proj] [pack] arguments in a non-valid osc working directory. --- osc/commandline.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/osc/commandline.py b/osc/commandline.py index 7eed3e52..1f95d451 100644 --- a/osc/commandline.py +++ b/osc/commandline.py @@ -6941,18 +6941,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: