mirror of
https://github.com/facebook/sapling.git
synced 2024-10-11 01:07:15 +03:00
e71276b303
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
45 lines
1.0 KiB
Perl
45 lines
1.0 KiB
Perl
$ extpath=`dirname $TESTDIR`
|
|
$ cp $extpath/hgext3rd/hiddenerror.py $TESTTMP
|
|
$ cat >> $HGRCPATH << EOF
|
|
> [extensions]
|
|
> hiddenerror=$TESTTMP/hiddenerror.py
|
|
> [experimental]
|
|
> evolution=all
|
|
> EOF
|
|
|
|
Create hidden changeset.
|
|
$ hg init repo && cd repo
|
|
$ hg debugbuilddag +1
|
|
$ hg debugobsolete 1ea73414a91b0920940797d8fc6a11e447f8ea1e
|
|
|
|
Test default error message.
|
|
$ hg log -r 0
|
|
abort: hidden changeset 1ea73414a91b!
|
|
[255]
|
|
|
|
Test custom error message without hash.
|
|
$ cat >> $HGRCPATH << EOF
|
|
> [hiddenerror]
|
|
> message = message without hash
|
|
> hint = hint without hash
|
|
> EOF
|
|
$ hg log -r 0
|
|
abort: message without hash!
|
|
(hint without hash)
|
|
[255]
|
|
|
|
Test custom error message with hash.
|
|
$ cat >> $HGRCPATH << EOF
|
|
> [hiddenerror]
|
|
> message = message with hash {}
|
|
> hint = hint with hash {}
|
|
> EOF
|
|
$ hg log -r 0
|
|
abort: message with hash 1ea73414a91b!
|
|
(hint with hash 1ea73414a91b)
|
|
[255]
|
|
|
|
Test that basic operations like `status` don't throw an exception due
|
|
to the wrapped context constructor.
|
|
$ hg status
|