开发者

Is there a way to make Mercurial give me a more verbose error message?

I'm having trouble with my hooks running on a remote server while the Mercurial process is running locally. The error message is not very informative, but I'm pretty sure it's a Python path issue. I get the error when I try to commit a changeset.

Is there anyway to get a complete stack trace? None of the following outputs are as helpful as a stack trace.

This is the regular error message:

C:\workspaces\test_next>hg commit -m "test"
Exception AttributeError: "'PPReleaseProject' object has no attribute '_projectname'" in <bound method PPReleaseProject.
__del__ of <testtrack.interface.PPReleaseProject object at 0x01BE35F0>> ignored

abort: precommit.fix_in_progress hook failed

This is the output with --traceback:

C:\workspaces\test_next>hg --traceback commit -m "test"
Exception AttributeError: "'PPReleaseProject' object has no attribute '_projectname'" in <bound method PPReleaseProject.
__del__ of <testtrack.interface.PPReleaseProject object at 0x01C065F0>> ignored

Traceback (most recent call last):
  File "mercurial\dispatch.pyo", line 54, in _runcatch
  File "mercurial\dispatch.pyo", line 494, in _dispatch
  File "mercurial\dispatch.pyo", line 355, in runcommand
  File "mercurial\dispatch.pyo", line 545, in _runcommand
  File "mercurial\dispatch.pyo", line 499, in checkargs
  File "mercurial\dispatch.pyo", line 492, in <lambda>
  File "mercurial\util.pyo", line 420, in check
  File "mercurial\commands.pyo", line 769, in commit
  File "mercurial\cmdutil.pyo", line 1209, in commit
  File "mercurial\commands.pyo", line 764, in commitfunc
  File "mercurial\localrepo.pyo", line 892, in commit
  File "mercurial\localrepo.pyo", line 153, in hook
  File "mercurial\hook.pyo", line 142开发者_JS百科, in hook
  File "mercurial\hook.pyo", line 84, in _pythonhook
Abort: precommit.fix_in_progress hook failed
abort: precommit.fix_in_progress hook failed

The output with --debug:

C:\workspaces\test_next>hg --debug commit -m "test"
calling hook precommit.branch_check: <function precommit_bad_branch at 0x01C585F0>
calling hook precommit.debug_code_check: <function precommit_contains_debug_code at 0x01C4A830>
calling hook precommit.fix_in_progress: <function precommit_fix_in_progress at 0x01C09270>
Exception AttributeError: "'PPReleaseProject' object has no attribute '_projectname'" in <bound method PPReleaseProject.
__del__ of <testtrack.interface.PPReleaseProject object at 0x01C5D5D0>> ignored

abort: precommit.fix_in_progress hook failed


Modify your hook script to catch exceptions (wrap it in a try...except block) and within the except clause, use the traceback module to format a full-length traceback and write it out to stderr/stdout?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜