Mailinglist Archive: opensuse-buildservice (199 mails)

< Previous Next >
Re: [opensuse-buildservice] [PATCH osc] osc co: print help instead of crashing if no arguments are given
  • From: Adrian Schröter <adrian@xxxxxxx>
  • Date: Wed, 08 Jun 2011 14:59:34 +0200
  • Message-id: <1427672.DrW7lDEfHk@scherben>
Am Wednesday, 8. June 2011, 13:35:47 schrieb Petr Uzel:
This fixes:

thanks, submitted to git.


~> osc checkout
Traceback (most recent call last):
File "/usr/bin/osc", line 21, in <module>
r = babysitter.run(osccli)
File "/usr/lib/python2.7/site-packages/osc/babysitter.py", line 52, in run
return prg.main()
File "/usr/lib/python2.7/site-packages/osc/cmdln.py", line 310, in main
return self.cmd(args)
File "/usr/lib/python2.7/site-packages/osc/cmdln.py", line 333, in cmd
retval = self.onecmd(argv)
File "/usr/lib/python2.7/site-packages/osc/cmdln.py", line 449, in onecmd
return self._dispatch_cmd(handler, argv)
File "/usr/lib/python2.7/site-packages/osc/cmdln.py", line 1179, in
_dispatch_cmd
return handler(argv[0], opts, *args)
File "/usr/lib/python2.7/site-packages/osc/commandline.py", line 3386, in
do_checkout
m = re.match(r"obs://([^/]+)/(\S+)/([^/]+)/([A-Fa-f\d]+)\-(\S+)", args[0])
IndexError: tuple index out of range

Signed-off-by: Petr Uzel <petr.uzel@xxxxxxx>
---
osc/commandline.py | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/osc/commandline.py b/osc/commandline.py
index e0981bb..adea1cf 100644
--- a/osc/commandline.py
+++ b/osc/commandline.py
@@ -3382,6 +3382,10 @@ Please submit there instead, or use --nodevelproject
to force direct submission.
else:
expand_link = True

+ if not args:
+ raise oscerr.WrongArgs('Incorrect number of arguments.\n\n' \
+ + self.get_cmd_help('checkout'))
+
# XXX: this too openSUSE-setup specific...
# FIXME: this should go into
~jw/patches/osc/osc.proj_pack_20101201.diff
# to be available to all subcommands via
@cmdline.prep(proj_pack)


--
Adrian Schroeter
SUSE Linux Products GmbH
email: adrian@xxxxxxx
< Previous Next >
References