mirror of
https://github.com/facebook/sapling.git
synced 2024-10-09 16:31:02 +03:00
0252fce55c
Summary: This allows people to silence hints as they like. It's done by modifying user hgrc. Reviewed By: markbt Differential Revision: D7392133 fbshipit-source-id: 1365294217db92dfb3a0c81332a9fefd164795d4
67 lines
1.6 KiB
Perl
67 lines
1.6 KiB
Perl
$ cat > showhint.py << EOF
|
|
> from mercurial import (
|
|
> cmdutil,
|
|
> hintutil,
|
|
> registrar,
|
|
> )
|
|
>
|
|
> cmdtable = {}
|
|
> command = registrar.command(cmdtable)
|
|
>
|
|
> hint = registrar.hint()
|
|
>
|
|
> @hint('next')
|
|
> def hintnext(a, b):
|
|
> return "use 'hg next' to go from %s to %s" % (a, b)
|
|
>
|
|
> @hint('export')
|
|
> def hintexport(a):
|
|
> return "use 'hg export %s' to show commit content" % (a,)
|
|
>
|
|
> @command('showhint', norepo=True)
|
|
> def showhint(*args):
|
|
> hintutil.trigger('export', 'P')
|
|
> hintutil.trigger('next', 'X', 'Y')
|
|
> hintutil.trigger('export', 'Q')
|
|
> EOF
|
|
|
|
$ setconfig extensions.showhint=$TESTTMP/showhint.py
|
|
|
|
$ hg showhint
|
|
hint[export]: use 'hg export P' to show commit content
|
|
hint[next]: use 'hg next' to go from X to Y
|
|
hint[hint-ack]: use 'hg hint --ack export next' to silence these hints
|
|
|
|
Test HGPLAIN=1 silences all hints
|
|
|
|
$ HGPLAIN=1 hg showhint
|
|
|
|
Test silence configs
|
|
|
|
$ hg showhint --config hint.ack-export=True
|
|
hint[next]: use 'hg next' to go from X to Y
|
|
hint[hint-ack]: use 'hg hint --ack next' to silence these hints
|
|
$ hg showhint --config hint.ack=next
|
|
hint[export]: use 'hg export P' to show commit content
|
|
hint[hint-ack]: use 'hg hint --ack export' to silence these hints
|
|
$ hg showhint --config hint.ack=*
|
|
|
|
Test hint --ack command
|
|
|
|
$ HGRCPATH=$HGRCPATH:$HOME/.hgrc
|
|
$ hg hint --ack next hint-ack
|
|
hints about next, hint-ack are silenced
|
|
$ cat .hgrc
|
|
[hint]
|
|
ack = next hint-ack
|
|
|
|
$ hg showhint
|
|
hint[export]: use 'hg export P' to show commit content
|
|
|
|
$ hg hint --ack export -q
|
|
$ cat .hgrc
|
|
[hint]
|
|
ack = next hint-ack export
|
|
|
|
$ hg showhint
|