# HG changeset patch # User Augie Fackler # Date 1227111384 21600 # Node ID f537eb456cf7b736353fb57581d8f42cc6fa5f73 # Parent 7486c6f6cccccaf6c8334794becd61cfe81e457c svncommand: Check traceback length to stop masking real exceptions. diff --git a/svncommand.py b/svncommand.py --- a/svncommand.py +++ b/svncommand.py @@ -1,6 +1,8 @@ import os import pickle import stat +import sys +import traceback from mercurial import hg from mercurial import node @@ -37,11 +39,18 @@ def svncmd(ui, repo, subcommand, *args, hg_repo_path=path, repo=repo, **opts) - except TypeError, e: - print e - print 'Bad arguments for subcommand %s' % subcommand + except TypeError: + tb = traceback.extract_tb(sys.exc_info()[2]) + if len(tb) == 1: + ui.status('Bad arguments for subcommand %s\n' % subcommand) + else: + raise except KeyError, e: - print 'Unknown subcommand %s' % subcommand + tb = traceback.extract_tb(sys.exc_info()[2]) + if len(tb) == 1: + ui.status('Unknown subcommand %s\n' % subcommand) + else: + raise @register_subcommand('help') def help_command(ui, args=None, **opts):