Commit Graph

3 Commits

Author SHA1 Message Date
Durham Goode
2bc65bd9db hiddenerror: fix out of bounds error
Summary:
The current code checks if the filter error reports a rev number, and if it does
tries to convert it to a node. If the 'number' is actually just a short form of
a hash that happens to be all digits, then it may be a number greater than the
size of the changelog, so we need to not attempt to access it in the changelog,
otherwise we get an IndexError.

Test Plan: Added a test, it failed before with a weird error

Reviewers: #mercurial, kulshrax

Reviewed By: kulshrax

Subscribers: mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4613988

Signature: t1:4613988:1488027938:4f5ffcb07aeecbaf59cad20fb3a592dd92ed2beb
2017-02-25 15:26:19 -08:00
Jun Wu
5966b1dbf1 test-hiddenerror: fix Python 2.6 compatibility 2017-02-21 11:11:10 -08:00
Arun Kulshreshtha
e71276b303 hiddenerror: make error message configurable
Summary:
This diff makes the following modifications to the (former) `hiddenhash` extension:

- Makes the error messages configurable, allowing us to easily change the error messages in `facebook.rc`.
- Renames the extension to `hiddenerror`, since the primary feature is now the configurable error messages rather than using a hash in the message.
- Changes the method by which the extension wraps the `changectx` constructor. The old method of wrapping would result in errors in code paths that in `context.py` that performed `isinstance()` checks on contexts.

Test Plan: To test arc patch this extension into your `facebook-hg-rpms` and enable it for a test repo. Then, attempt to access a hidden node. You should see the default error message defined in the extension. Setting `hiddenerror.message` and `hiddenerror.hint` should allow you to customize the messages. See test file for examples.

Reviewers: #mercurial, rmcelroy

Reviewed By: rmcelroy

Subscribers: rmcelroy, durham, mjpieters

Differential Revision: https://phabricator.intern.facebook.com/D4548140

Tasks: 15896355

Signature: t1:4548140:1487063552:06395c1eaaa83b00ead8e80e2cd8f9d13f7d08e2
2017-02-14 11:15:19 -08:00