mirror of
https://github.com/facebook/sapling.git
synced 2024-10-10 16:57:49 +03:00
svn metacommand: improved argument checking
We now fail gracefully in case of a missing or invalid argument to 'update', and in case of an unknown subcommand.
This commit is contained in:
parent
ee2c3c6bcd
commit
1618736125
@ -302,8 +302,15 @@ def update(ui, args, repo, clean=False, **opts):
|
||||
"""update to a specified Subversion revision number
|
||||
"""
|
||||
|
||||
assert len(args) == 1
|
||||
rev = int(args[0])
|
||||
try:
|
||||
rev = int(args[0])
|
||||
except IndexError:
|
||||
raise error.CommandError('svn',
|
||||
"no revision number specified for 'update'")
|
||||
except ValueError:
|
||||
raise error.Abort("'%s' is not a valid Subversion revision number"
|
||||
% args[0])
|
||||
|
||||
meta = repo.svnmeta()
|
||||
|
||||
answers = []
|
||||
@ -457,6 +464,9 @@ def svn(ui, repo, subcommand, *args, **opts):
|
||||
candidates.append(c)
|
||||
if len(candidates) == 1:
|
||||
subcommand = candidates[0]
|
||||
elif not candidates:
|
||||
raise error.CommandError('svn',
|
||||
"unknown subcommand '%s'" % subcommand)
|
||||
else:
|
||||
raise error.AmbiguousCommand(subcommand, candidates)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user