diff 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
line wrap: on
line diff
--- a/tests/test-help.t	Sat Oct 23 17:30:08 2010 +0200
+++ b/tests/test-help.t	Sat Oct 23 19:21:49 2010 +0200
@@ -756,3 +756,30 @@
       The reserved name "." indicates the working directory parent. If no
       working directory is checked out, it is equivalent to null. If an
       uncommitted merge is in progress, "." is the revision of the first parent.
+
+Test help hooks
+
+  $ cat > helphook1.py <<EOF
+  > from mercurial import help
+  > 
+  > def rewrite(topic, doc):
+  >     return doc + '\nhelphook1\n'
+  > 
+  > def extsetup(ui):
+  >     help.addtopichook('revsets', rewrite)
+  > EOF
+  $ cat > helphook2.py <<EOF
+  > from mercurial import help
+  > 
+  > def rewrite(topic, doc):
+  >     return doc + '\nhelphook2\n'
+  > 
+  > def extsetup(ui):
+  >     help.addtopichook('revsets', rewrite)
+  > EOF
+  $ echo '[extensions]' >> $HGRCPATH
+  $ echo "helphook1 = `pwd`/helphook1.py" >> $HGRCPATH
+  $ echo "helphook2 = `pwd`/helphook2.py" >> $HGRCPATH
+  $ hg help revsets | grep helphook
+      helphook1
+      helphook2