Mailinglist Archive: opensuse-factory (710 mails)

< Previous Next >
[opensuse-factory] [PATCH osc] osc co: print help instead of crashing if no arguments are given
This fixes:

~> 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)
--
1.7.3.4


Petr

--
Petr Uzel
IRC: ptr_uzl @ freenode
< Previous Next >
This Thread
Follow Ups