1
0
mirror of https://github.com/openSUSE/osc.git synced 2025-01-22 21:16:16 +01:00

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@suse.cz>
This commit is contained in:
Petr Uzel 2011-06-08 13:35:47 +02:00 committed by Adrian Schröter
parent b04550afc6
commit 95febe963b

View File

@ -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)