For now, setting this environment variable will make StGIT dump the
backtrace in case of a failure.
Signed-off-by: Catalin Marinas <catalin.marinas@gmail.com>
from stgit.commands.common import CmdException
from stgit.gitmergeonefile import GitMergeException
from stgit.commands.common import CmdException
from stgit.gitmergeonefile import GitMergeException
+ try:
+ debug_level = int(os.environ['STGIT_DEBUG_LEVEL'])
+ except KeyError:
+ debug_level = 0
+ except ValueError:
+ print >> sys.stderr, 'Invalid STGIT_DEBUG_LEVEL environment variable'
+ sys.exit(1)
+
except (IOError, ParsingError, NoSectionError, CmdException,
StackException, GitException, GitMergeException), err:
print >> sys.stderr, '%s %s: %s' % (prog, cmd, err)
except (IOError, ParsingError, NoSectionError, CmdException,
StackException, GitException, GitMergeException), err:
print >> sys.stderr, '%s %s: %s' % (prog, cmd, err)
+ if debug_level:
+ raise
+ else:
+ sys.exit(2)
except KeyboardInterrupt:
sys.exit(1)
except KeyboardInterrupt:
sys.exit(1)
echo "$test_description"
exit 0 ;;
-v|--v|--ve|--ver|--verb|--verbo|--verbos|--verbose)
echo "$test_description"
exit 0 ;;
-v|--v|--ve|--ver|--verb|--verbo|--verbos|--verbose)
+ export STGIT_DEBUG_LEVEL="-1"
verbose=t; shift ;;
*)
break ;;
verbose=t; shift ;;
*)
break ;;