sapling/tests/test-rage.t
Jun Wu bcd74ba1c5 rage: silence exceptions when reading details
Summary:
rage is a basic tool to collect diagnostic information that should not break.
To ensure it works all the time, this patch:

  - unbreaks hg rage from upstream change dad6404ccd
  - wraps every non-trivial functions with `try`, `catch`
  - adds a naive test about `hg rage --preview`

Test Plan:
Run `test-rage.t`. Comment out `import blackbox` and check:

```
hg blackbox -l20:
---------------------------
(Failed. See footnote [1])

[1]: global name 'blackbox' is not defined
Traceback (most recent call last):
  File "/home/quark/fb-hgext/rage.py", line 22, in _failsafe
    return func()
  File "/home/quark/fb-hgext/rage.py", line 97, in <lambda>
    _failsafe(lambda: hgcmd(blackbox.blackbox, limit=20))),
NameError: global name 'blackbox' is not defined
```

Reviewers: #sourcecontrol, wez, ttung, durham

Reviewed By: durham

Subscribers: durham, wez, mjpieters

Differential Revision: https://phabricator.fb.com/D2928778

Tasks: 10028490

Signature: t1:2928778:1455240651:d39ceed5d045e279160690e0a93a4e326d307db3
2016-02-11 21:00:33 +00:00

10 lines
166 B
Perl

$ cat >> $HGRCPATH << EOF
> [extensions]
> rage=$TESTDIR/../rage.py
> EOF
$ hg init repo
$ cd repo
$ hg rage --preview | grep -o 'blackbox'
blackbox