comparison svncommand.py @ 93:f537eb456cf7

svncommand: Check traceback length to stop masking real exceptions.
author Augie Fackler <durin42@gmail.com>
date Wed, 19 Nov 2008 10:16:24 -0600
parents ef5d7a7aabb0
children b5651f53e7ae
comparison
equal deleted inserted replaced
92:7486c6f6cccc 93:f537eb456cf7
1 import os 1 import os
2 import pickle 2 import pickle
3 import stat 3 import stat
4 import sys
5 import traceback
4 6
5 from mercurial import hg 7 from mercurial import hg
6 from mercurial import node 8 from mercurial import node
7 from mercurial import util as merc_util 9 from mercurial import util as merc_util
8 10
35 opts['svn_url'] = open(os.path.join(repo.path, 'svn', 'url')).read() 37 opts['svn_url'] = open(os.path.join(repo.path, 'svn', 'url')).read()
36 return svn_subcommands[subcommand](ui, args=args, 38 return svn_subcommands[subcommand](ui, args=args,
37 hg_repo_path=path, 39 hg_repo_path=path,
38 repo=repo, 40 repo=repo,
39 **opts) 41 **opts)
40 except TypeError, e: 42 except TypeError:
41 print e 43 tb = traceback.extract_tb(sys.exc_info()[2])
42 print 'Bad arguments for subcommand %s' % subcommand 44 if len(tb) == 1:
45 ui.status('Bad arguments for subcommand %s\n' % subcommand)
46 else:
47 raise
43 except KeyError, e: 48 except KeyError, e:
44 print 'Unknown subcommand %s' % subcommand 49 tb = traceback.extract_tb(sys.exc_info()[2])
50 if len(tb) == 1:
51 ui.status('Unknown subcommand %s\n' % subcommand)
52 else:
53 raise
45 54
46 @register_subcommand('help') 55 @register_subcommand('help')
47 def help_command(ui, args=None, **opts): 56 def help_command(ui, args=None, **opts):
48 """Get help on the subsubcommands. 57 """Get help on the subsubcommands.
49 """ 58 """