This is an archive of the discontinued Mercurial Phabricator instance.

extensions: ignore exceptions from an extension's `getversion()` method
ClosedPublic

Authored by mharbison72 on Apr 30 2021, 8:47 PM.

Details

Summary

This method is usually called when there's a stacktrace being generated, or with
hg version -v. Raising another exception risks mangling the bug report info.

I hit this issue when trying to add the method to the keyring extension to
report the version of the extension and the underlying module, and ran into
demandimport issues prior to py3.8. It seems like a wise thing to do anyway,
though unfortunately there's no convenient ui object around to issue a
warning. Use 'unknown' to signal that it tried to report a version and failed,
unlike the default case of printing nothing.

Diff Detail

Repository
rHG Mercurial
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

mharbison72 created this revision.Apr 30 2021, 8:47 PM
mharbison72 edited the summary of this revision. (Show Details)Apr 30 2021, 9:08 PM
mharbison72 updated this revision to Diff 27267.
pulkit accepted this revision.May 3 2021, 5:47 AM
This revision is now accepted and ready to land.May 3 2021, 5:47 AM