comparison tests/test-help.t @ 12820:0edc0aa7432d stable

help: add topic rewriting hooks They are useful when updating help topics dynamically from extensions.
author Patrick Mezard <pmezard@gmail.com>
date Sat, 23 Oct 2010 19:21:49 +0200
parents e8a8993b625e
children af1006d2f970
comparison
equal deleted inserted replaced
12819:5082e2f3f8e0 12820:0edc0aa7432d
754 of an empty repository, and the parent of revision 0. 754 of an empty repository, and the parent of revision 0.
755 755
756 The reserved name "." indicates the working directory parent. If no 756 The reserved name "." indicates the working directory parent. If no
757 working directory is checked out, it is equivalent to null. If an 757 working directory is checked out, it is equivalent to null. If an
758 uncommitted merge is in progress, "." is the revision of the first parent. 758 uncommitted merge is in progress, "." is the revision of the first parent.
759
760 Test help hooks
761
762 $ cat > helphook1.py <<EOF
763 > from mercurial import help
764 >
765 > def rewrite(topic, doc):
766 > return doc + '\nhelphook1\n'
767 >
768 > def extsetup(ui):
769 > help.addtopichook('revsets', rewrite)
770 > EOF
771 $ cat > helphook2.py <<EOF
772 > from mercurial import help
773 >
774 > def rewrite(topic, doc):
775 > return doc + '\nhelphook2\n'
776 >
777 > def extsetup(ui):
778 > help.addtopichook('revsets', rewrite)
779 > EOF
780 $ echo '[extensions]' >> $HGRCPATH
781 $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
782 $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
783 $ hg help revsets | grep helphook
784 helphook1
785 helphook2