有没有办法让 Mercurial 给我更详细的错误消息?

发布于 2024-09-30 23:15:07 字数 2366 浏览 4 评论 0原文

当 Mercurial 进程在本地运行时,我的钩子在远程服务器上运行时遇到问题。错误消息信息不是很丰富,但我很确定这是一个 Python 路径问题。当我尝试提交变更集时出现错误。

有没有办法获得完整的堆栈跟踪?以下输出都没有堆栈跟踪那么有用。

这是常规错误消息:

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

这是 --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, in hook
  File "mercurial\hook.pyo", line 84, in _pythonhook
Abort: precommit.fix_in_progress hook failed
abort: precommit.fix_in_progress hook failed

--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

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, 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

说谎友 2024-10-07 23:15:07

修改您的钩子脚本以捕获异常(将其包装在 try... except 块中),并在 except 子句中使用 traceback 模块格式化全长回溯并将其写出到 stderr/stdout?

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?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文