[PATCH 1 of 1 v2] web: add a help view for getting hg help output

Augie Fackler durin42 at gmail.com
Sat Oct 9 12:34:08 CDT 2010


# HG changeset patch
# User Augie Fackler <durin42 at gmail.com>
# Date 1286645234 18000
# Node ID 0c9876ea8430746148fd5d9faf8c4d747cd264ab
# Parent  5192b24f309ce6e7a7442103234a41b2779534f4
web: add a help view for getting hg help output

diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py
--- a/mercurial/hgweb/webcommands.py
+++ b/mercurial/hgweb/webcommands.py
@@ -13,6 +13,9 @@
 from common import paritygen, staticfile, get_contact, ErrorResponse
 from common import HTTP_OK, HTTP_FORBIDDEN, HTTP_NOT_FOUND
 from mercurial import graphmod
+from mercurial import help as helpmod
+from mercurial import ui
+from mercurial.i18n import _
 
 # __all__ is populated with the allowed commands. Be sure to add to it if
 # you're adding a new command, or the new command won't work.
@@ -20,7 +23,7 @@
 __all__ = [
    'log', 'rawfile', 'file', 'changelog', 'shortlog', 'changeset', 'rev',
    'manifest', 'tags', 'branches', 'summary', 'filediff', 'diff', 'annotate',
-   'filelog', 'archive', 'static', 'graph',
+   'filelog', 'archive', 'static', 'graph', 'help',
 ]
 
 def log(web, req, tmpl):
@@ -724,3 +727,58 @@
                 lessvars=lessvars, morevars=morevars, downrev=downrev,
                 canvasheight=canvasheight, jsdata=data, bg_height=bg_height,
                 node=revnode_hex, changenav=changenav)
+
+def _getdoc(e):
+    doc = e[0].__doc__
+    if doc:
+        doc = doc.split('\n')[0]
+    else:
+        doc = _('(no help text available)')
+    return doc
+
+def help(web, req, tmpl):
+    from mercurial import commands # avoid cycle
+
+    topicname = req.form.get('node', [None])[0]
+    if not topicname:
+        topic = []
+
+        def topics(**map):
+            for entries, summary, _ in helpmod.helptable:
+                entries = sorted(entries, key=len)
+                yield {'topic': entries[-1], 'summary': summary}
+
+        early, other = [], []
+        primary = lambda s: s.split('|')[0]
+        for c, e in commands.table.iteritems():
+            doc = _getdoc(e)
+            if 'DEPRECATED' in doc or c.startswith('debug'):
+                continue
+            cmd = primary(c)
+            if cmd.startswith('^'):
+                early.append((cmd[1:], doc))
+            else:
+                other.append((cmd, doc))
+
+        early.sort()
+        other.sort()
+
+        def earlycommands(**map):
+            for c, doc in early:
+                yield {'topic': c, 'summary': doc}
+
+        def othercommands(**map):
+            for c, doc in other:
+                yield {'topic': c, 'summary': doc}
+
+        return tmpl('helptopics', topics=topics, earlycommands=earlycommands,
+                    othercommands=othercommands, title='Index')
+
+    u = ui.ui()
+    u.pushbuffer()
+    try:
+        commands.help_(u, topicname)
+    except error.UnknownCommand:
+        raise ErrorResponse(HTTP_NOT_FOUND)
+    doc = u.popbuffer()
+    return tmpl('help', topic=topicname, doc=doc)
diff --git a/mercurial/templates/coal/map b/mercurial/templates/coal/map
--- a/mercurial/templates/coal/map
+++ b/mercurial/templates/coal/map
@@ -10,6 +10,11 @@
 shortlogentry = ../paper/shortlogentry.tmpl
 graph = ../paper/graph.tmpl
 
+help = ../paper/help.tmpl
+helptopics = ../paper/helptopics.tmpl
+
+helpentry = '<tr><td><a href="{url}help/{topic|escape}{sessionvars%urlparameter}">{topic|escape}</a></td><td>{summary|escape}</td></tr>'
+
 naventry = '<a href="{url}log/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
 navshortentry = '<a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
 navgraphentry = '<a href="{url}graph/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
diff --git a/mercurial/templates/gitweb/branches.tmpl b/mercurial/templates/gitweb/branches.tmpl
--- a/mercurial/templates/gitweb/branches.tmpl
+++ b/mercurial/templates/gitweb/branches.tmpl
@@ -18,7 +18,8 @@
 <a href="{url}graph{sessionvars%urlparameter}">graph</a> |
 <a href="{url}tags{sessionvars%urlparameter}">tags</a> |
 branches |
-<a href="{url}file/{node|short}{sessionvars%urlparameter}">files</a>
+<a href="{url}file/{node|short}{sessionvars%urlparameter}">files</a> |
+<a href="{url}help{sessionvars%urlparameter}">help</a>
 <br/>
 </div>
 
diff --git a/mercurial/templates/gitweb/changelog.tmpl b/mercurial/templates/gitweb/changelog.tmpl
--- a/mercurial/templates/gitweb/changelog.tmpl
+++ b/mercurial/templates/gitweb/changelog.tmpl
@@ -25,7 +25,8 @@
 <a href="{url}graph{sessionvars%urlparameter}">graph</a> |
 <a href="{url}tags{sessionvars%urlparameter}">tags</a> |
 <a href="{url}branches{sessionvars%urlparameter}">branches</a> |
-<a href="{url}file/{node|short}{sessionvars%urlparameter}">files</a>{archives%archiveentry}
+<a href="{url}file/{node|short}{sessionvars%urlparameter}">files</a>{archives%archiveentry} |
+<a href="{url}help{sessionvars%urlparameter}">help</a>
 <br/>
 {changenav%nav}<br/>
 </div>
diff --git a/mercurial/templates/gitweb/changeset.tmpl b/mercurial/templates/gitweb/changeset.tmpl
--- a/mercurial/templates/gitweb/changeset.tmpl
+++ b/mercurial/templates/gitweb/changeset.tmpl
@@ -20,7 +20,9 @@
 <a href="{url}branches{sessionvars%urlparameter}">branches</a> |
 <a href="{url}file/{node|short}{sessionvars%urlparameter}">files</a> |
 changeset |
-<a href="{url}raw-rev/{node|short}">raw</a> {archives%archiveentry}<br/>
+<a href="{url}raw-rev/{node|short}">raw</a> {archives%archiveentry} |
+<a href="{url}help{sessionvars%urlparameter}">help</a>
+<br/>
 </div>
 
 <div>
diff --git a/mercurial/templates/gitweb/filediff.tmpl b/mercurial/templates/gitweb/filediff.tmpl
--- a/mercurial/templates/gitweb/filediff.tmpl
+++ b/mercurial/templates/gitweb/filediff.tmpl
@@ -25,7 +25,8 @@
 <a href="{url}log/{node|short}/{file|urlescape}{sessionvars%urlparameter}">revisions</a> |
 <a href="{url}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}">annotate</a> |
 diff |
-<a href="{url}raw-diff/{node|short}/{file|urlescape}">raw</a><br/>
+<a href="{url}raw-diff/{node|short}/{file|urlescape}">raw</a><br/> |
+<a href="{url}help{sessionvars%urlparameter}">help</a>
 </div>
 
 <div class="title">{file|escape}</div>
diff --git a/mercurial/templates/gitweb/graph.tmpl b/mercurial/templates/gitweb/graph.tmpl
--- a/mercurial/templates/gitweb/graph.tmpl
+++ b/mercurial/templates/gitweb/graph.tmpl
@@ -25,7 +25,8 @@
 graph |
 <a href="{url}tags{sessionvars%urlparameter}">tags</a> |
 <a href="{url}branches{sessionvars%urlparameter}">branches</a> |
-<a href="{url}file/{node|short}{sessionvars%urlparameter}">files</a>
+<a href="{url}file/{node|short}{sessionvars%urlparameter}">files</a> |
+<a href="{url}help{sessionvars%urlparameter}">help</a>
 <br/>
 <a href="{url}graph/{rev}{lessvars%urlparameter}">less</a>
 <a href="{url}graph/{rev}{morevars%urlparameter}">more</a>
diff --git a/mercurial/templates/gitweb/branches.tmpl b/mercurial/templates/gitweb/help.tmpl
copy from mercurial/templates/gitweb/branches.tmpl
copy to mercurial/templates/gitweb/help.tmpl
--- a/mercurial/templates/gitweb/branches.tmpl
+++ b/mercurial/templates/gitweb/help.tmpl
@@ -23,8 +23,9 @@
 </div>
 
 <div class="title">&nbsp;</div>
-<table cellspacing="0">
-{entries%branchentry}
-</table>
+
+<pre>
+{doc|escape}
+</pre>
 
 {footer}
diff --git a/mercurial/templates/gitweb/branches.tmpl b/mercurial/templates/gitweb/helptopics.tmpl
copy from mercurial/templates/gitweb/branches.tmpl
copy to mercurial/templates/gitweb/helptopics.tmpl
--- a/mercurial/templates/gitweb/branches.tmpl
+++ b/mercurial/templates/gitweb/helptopics.tmpl
@@ -17,14 +17,22 @@
 <a href="{url}log{sessionvars%urlparameter}">changelog</a> |
 <a href="{url}graph{sessionvars%urlparameter}">graph</a> |
 <a href="{url}tags{sessionvars%urlparameter}">tags</a> |
-branches |
-<a href="{url}file/{node|short}{sessionvars%urlparameter}">files</a>
+<a href="{url}branches{sessionvars%urlparameter}">branches</a> |
+<a href="{url}file/{node|short}{sessionvars%urlparameter}">files</a> |
+help
 <br/>
 </div>
 
 <div class="title">&nbsp;</div>
 <table cellspacing="0">
-{entries%branchentry}
+<tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr>
+{topics % helpentry}
+
+<tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
+{earlycommands % helpentry}
+
+<tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
+{othercommands % helpentry}
 </table>
 
 {footer}
diff --git a/mercurial/templates/gitweb/manifest.tmpl b/mercurial/templates/gitweb/manifest.tmpl
--- a/mercurial/templates/gitweb/manifest.tmpl
+++ b/mercurial/templates/gitweb/manifest.tmpl
@@ -19,7 +19,9 @@
 <a href="{url}tags{sessionvars%urlparameter}">tags</a> |
 <a href="{url}branches{sessionvars%urlparameter}">branches</a> |
 files |
-<a href="{url}rev/{node|short}{sessionvars%urlparameter}">changeset</a> {archives%archiveentry}<br/>
+<a href="{url}rev/{node|short}{sessionvars%urlparameter}">changeset</a> {archives%archiveentry} |
+<a href="{url}help{sessionvars%urlparameter}">help</a>
+<br/>
 </div>
 
 <div class="title">{path|escape} <span class="logtags">{inbranch%inbranchtag}{branches%branchtag}{tags%tagtag}</span></div>
diff --git a/mercurial/templates/gitweb/map b/mercurial/templates/gitweb/map
--- a/mercurial/templates/gitweb/map
+++ b/mercurial/templates/gitweb/map
@@ -7,6 +7,12 @@
 summary = summary.tmpl
 error = error.tmpl
 notfound = notfound.tmpl
+
+help = help.tmpl
+helptopics = helptopics.tmpl
+
+helpentry = '<tr><td><a href="{url}help/{topic|escape}{sessionvars%urlparameter}">{topic|escape}</a></td><td>{summary|escape}</td></tr>'
+
 naventry = '<a href="{url}log/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
 navshortentry = '<a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
 navgraphentry = '<a href="{url}graph/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
diff --git a/mercurial/templates/gitweb/shortlog.tmpl b/mercurial/templates/gitweb/shortlog.tmpl
--- a/mercurial/templates/gitweb/shortlog.tmpl
+++ b/mercurial/templates/gitweb/shortlog.tmpl
@@ -24,7 +24,8 @@
 <a href="{url}graph{sessionvars%urlparameter}">graph</a> |
 <a href="{url}tags{sessionvars%urlparameter}">tags</a> |
 <a href="{url}branches{sessionvars%urlparameter}">branches</a> |
-<a href="{url}file/{node|short}{sessionvars%urlparameter}">files</a>{archives%archiveentry}
+<a href="{url}file/{node|short}{sessionvars%urlparameter}">files</a>{archives%archiveentry} |
+<a href="{url}help{sessionvars%urlparameter}">help</a>
 <br/>{changenav%navshort}<br/>
 </div>
 
diff --git a/mercurial/templates/gitweb/summary.tmpl b/mercurial/templates/gitweb/summary.tmpl
--- a/mercurial/templates/gitweb/summary.tmpl
+++ b/mercurial/templates/gitweb/summary.tmpl
@@ -25,7 +25,8 @@
 <a href="{url}graph{sessionvars%urlparameter}">graph</a> |
 <a href="{url}tags{sessionvars%urlparameter}">tags</a> |
 <a href="{url}branches{sessionvars%urlparameter}">branches</a> |
-<a href="{url}file/{node|short}{sessionvars%urlparameter}">files</a>{archives%archiveentry}
+<a href="{url}file/{node|short}{sessionvars%urlparameter}">files</a>{archives%archiveentry} |
+<a href="{url}help{sessionvars%urlparameter}">help</a>
 <br/>
 </div>
 
diff --git a/mercurial/templates/gitweb/tags.tmpl b/mercurial/templates/gitweb/tags.tmpl
--- a/mercurial/templates/gitweb/tags.tmpl
+++ b/mercurial/templates/gitweb/tags.tmpl
@@ -18,7 +18,8 @@
 <a href="{url}graph{sessionvars%urlparameter}">graph</a> |
 tags |
 <a href="{url}branches{sessionvars%urlparameter}">branches</a> |
-<a href="{url}file/{node|short}{sessionvars%urlparameter}">files</a>
+<a href="{url}file/{node|short}{sessionvars%urlparameter}">files</a> |
+<a href="{url}help{sessionvars%urlparameter}">help</a>
 <br/>
 </div>
 
diff --git a/mercurial/templates/monoblue/branches.tmpl b/mercurial/templates/monoblue/branches.tmpl
--- a/mercurial/templates/monoblue/branches.tmpl
+++ b/mercurial/templates/monoblue/branches.tmpl
@@ -25,6 +25,8 @@
             <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li>
             <li class="current">branches</li>
             <li><a href="{url}file/{node|short}{sessionvars%urlparameter}">files</a></li>
+	    <li><a href="{url}help{sessionvars%urlparameter}">help</a></li>
+	    <li><a href="{url}help{sessionvars%urlparameter}">help</a></li>
         </ul>
     </div>
 
diff --git a/mercurial/templates/monoblue/changelog.tmpl b/mercurial/templates/monoblue/changelog.tmpl
--- a/mercurial/templates/monoblue/changelog.tmpl
+++ b/mercurial/templates/monoblue/changelog.tmpl
@@ -25,6 +25,7 @@
             <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li>
             <li><a href="{url}branches{sessionvars%urlparameter}">branches</a></li>
             <li><a href="{url}file/{node|short}{sessionvars%urlparameter}">files</a>{archives%archiveentry}</li>
+	    <li><a href="{url}help{sessionvars%urlparameter}">help</a></li>
         </ul>
     </div>
 
diff --git a/mercurial/templates/monoblue/graph.tmpl b/mercurial/templates/monoblue/graph.tmpl
--- a/mercurial/templates/monoblue/graph.tmpl
+++ b/mercurial/templates/monoblue/graph.tmpl
@@ -26,6 +26,7 @@
             <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li>
             <li><a href="{url}branches{sessionvars%urlparameter}">branches</a></li>
             <li><a href="{url}file/{node|short}{sessionvars%urlparameter}">files</a></li>
+	    <li><a href="{url}help{sessionvars%urlparameter}">help</a></li>
         </ul>
     </div>
 
diff --git a/mercurial/templates/monoblue/branches.tmpl b/mercurial/templates/monoblue/help.tmpl
copy from mercurial/templates/monoblue/branches.tmpl
copy to mercurial/templates/monoblue/help.tmpl
--- a/mercurial/templates/monoblue/branches.tmpl
+++ b/mercurial/templates/monoblue/help.tmpl
@@ -23,14 +23,15 @@
             <li><a href="{url}changelog{sessionvars%urlparameter}">changelog</a></li>
             <li><a href="{url}graph/{node|short}{sessionvars%urlparameter}">graph</a></li>
             <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li>
-            <li class="current">branches</li>
+            <li><a href="{url}branches{sessionvars%urlparameter}">branches</a></li>
             <li><a href="{url}file/{node|short}{sessionvars%urlparameter}">files</a></li>
+	    <li class="current">help</li>
         </ul>
     </div>
 
     <h2 class="no-link no-border">branches</h2>
-    <table cellspacing="0">
-{entries%branchentry}
-    </table>
+    <pre>
+    {doc|escape}
+    </pre>
 
 {footer}
diff --git a/mercurial/templates/monoblue/branches.tmpl b/mercurial/templates/monoblue/helptopics.tmpl
copy from mercurial/templates/monoblue/branches.tmpl
copy to mercurial/templates/monoblue/helptopics.tmpl
--- a/mercurial/templates/monoblue/branches.tmpl
+++ b/mercurial/templates/monoblue/helptopics.tmpl
@@ -23,14 +23,22 @@
             <li><a href="{url}changelog{sessionvars%urlparameter}">changelog</a></li>
             <li><a href="{url}graph/{node|short}{sessionvars%urlparameter}">graph</a></li>
             <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li>
-            <li class="current">branches</li>
+            <li><a href="{url}help{sessionvars%urlparameter}">branches</a></li>
             <li><a href="{url}file/{node|short}{sessionvars%urlparameter}">files</a></li>
+	    <li class="current">help</li>
         </ul>
     </div>
 
     <h2 class="no-link no-border">branches</h2>
     <table cellspacing="0">
-{entries%branchentry}
+    <tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr>
+    {topics % helpentry}
+
+    <tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
+    {earlycommands % helpentry}
+
+    <tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
+    {othercommands % helpentry}
     </table>
 
 {footer}
diff --git a/mercurial/templates/monoblue/manifest.tmpl b/mercurial/templates/monoblue/manifest.tmpl
--- a/mercurial/templates/monoblue/manifest.tmpl
+++ b/mercurial/templates/monoblue/manifest.tmpl
@@ -25,6 +25,7 @@
             <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li>
             <li><a href="{url}branches{sessionvars%urlparameter}">branches</a></li>
             <li class="current">files</li>
+	    <li><a href="{url}help{sessionvars%urlparameter}">help</a></li>
         </ul>
     </div>
 
diff --git a/mercurial/templates/monoblue/map b/mercurial/templates/monoblue/map
--- a/mercurial/templates/monoblue/map
+++ b/mercurial/templates/monoblue/map
@@ -7,6 +7,12 @@
 summary = summary.tmpl
 error = error.tmpl
 notfound = notfound.tmpl
+
+help = help.tmpl
+helptopics = helptopics.tmpl
+
+helpentry = '<tr><td><a href="{url}help/{topic|escape}{sessionvars%urlparameter}">{topic|escape}</a></td><td>{summary|escape}</td></tr>'
+
 naventry = '<a href="{url}log/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
 navshortentry = '<a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
 navgraphentry = '<a href="{url}graph/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
@@ -75,7 +81,7 @@
   <tr class="parity{parity}">
     <td class="linenr">
       <a href="{url}annotate/{node|short}/{file|urlescape}{sessionvars%urlparameter}#{targetline}"
-         title="{node|short}: {desc|escape|firstline}">{author|user}@{rev}</a>
+	 title="{node|short}: {desc|escape|firstline}">{author|user}@{rev}</a>
     </td>
     <td class="lineno">
       <a href="#{lineid}" id="{lineid}">{linenumber}</a>
diff --git a/mercurial/templates/monoblue/shortlog.tmpl b/mercurial/templates/monoblue/shortlog.tmpl
--- a/mercurial/templates/monoblue/shortlog.tmpl
+++ b/mercurial/templates/monoblue/shortlog.tmpl
@@ -24,7 +24,9 @@
             <li><a href="{url}graph/{node|short}{sessionvars%urlparameter}">graph</a></li>
             <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li>
             <li><a href="{url}branches{sessionvars%urlparameter}">branches</a></li>
-            <li><a href="{url}file/{node|short}{sessionvars%urlparameter}">files</a>{archives%archiveentry}</li>
+            <li><a href="{url}file/{node|short}{sessionvars%urlparameter}">files</a></li>
+	    {archives%archiveentry}
+	    <li><a href="{url}help{sessionvars%urlparameter}">help</a></li>
         </ul>
     </div>
 
diff --git a/mercurial/templates/monoblue/summary.tmpl b/mercurial/templates/monoblue/summary.tmpl
--- a/mercurial/templates/monoblue/summary.tmpl
+++ b/mercurial/templates/monoblue/summary.tmpl
@@ -25,6 +25,7 @@
             <li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li>
             <li><a href="{url}branches{sessionvars%urlparameter}">branches</a></li>
             <li><a href="{url}file/{node|short}{sessionvars%urlparameter}">files</a></li>
+	    <li><a href="{url}help{sessionvars%urlparameter}">help</a></li>
         </ul>
     </div>
 
diff --git a/mercurial/templates/monoblue/tags.tmpl b/mercurial/templates/monoblue/tags.tmpl
--- a/mercurial/templates/monoblue/tags.tmpl
+++ b/mercurial/templates/monoblue/tags.tmpl
@@ -25,6 +25,7 @@
             <li class="current">tags</li>
             <li><a href="{url}branches{sessionvars%urlparameter}">branches</a></li>
             <li><a href="{url}file/{node|short}{sessionvars%urlparameter}">files</a></li>
+	    <li><a href="{url}help{sessionvars%urlparameter}">help</a></li>
         </ul>
     </div>
 
diff --git a/mercurial/templates/paper/changeset.tmpl b/mercurial/templates/paper/changeset.tmpl
--- a/mercurial/templates/paper/changeset.tmpl
+++ b/mercurial/templates/paper/changeset.tmpl
@@ -22,6 +22,9 @@
 <ul>
  {archives%archiveentry}
 </ul>
+<ul>
+ <li><a href="{url}help{sessionvars%urlparameter}">help</a></li>
+</ul>
 </div>
 
 <div class="main">
diff --git a/mercurial/templates/paper/graph.tmpl b/mercurial/templates/paper/graph.tmpl
--- a/mercurial/templates/paper/graph.tmpl
+++ b/mercurial/templates/paper/graph.tmpl
@@ -24,6 +24,9 @@
 <li><a href="{url}rev/{node|short}{sessionvars%urlparameter}">changeset</a></li>
 <li><a href="{url}file/{node|short}{path|urlescape}{sessionvars%urlparameter}">browse</a></li>
 </ul>
+<ul>
+ <li><a href="{url}help{sessionvars%urlparameter}">help</a></li>
+</ul>
 </div>
 
 <div class="main">
diff --git a/mercurial/templates/paper/help.tmpl b/mercurial/templates/paper/help.tmpl
new file mode 100644
--- /dev/null
+++ b/mercurial/templates/paper/help.tmpl
@@ -0,0 +1,43 @@
+{header}
+<title>Help: {topic}</title>
+<link rel="alternate" type="application/atom+xml"
+   href="{url}atom-tags" title="Atom feed for {repo|escape}: branches" />
+<link rel="alternate" type="application/rss+xml"
+   href="{url}rss-tags" title="RSS feed for {repo|escape}: branches" />
+</head>
+<body>
+
+<div class="container">
+<div class="menu">
+<div class="logo">
+<a href="http://mercurial.selenic.com/">
+<img src="{staticurl}hglogo.png" alt="mercurial" /></a>
+</div>
+<ul>
+<li><a href="{url}shortlog{sessionvars%urlparameter}">log</a></li>
+<li><a href="{url}graph{sessionvars%urlparameter}">graph</a></li>
+<li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li>
+<li><a href="{url}branches{sessionvars%urlparameter}">branches</a></li>
+</ul>
+<ul>
+ <li class="active">help</li>
+</ul>
+</div>
+
+<div class="main">
+<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
+<h3>Help: {topic}</h3>
+
+<form class="search" action="{url}log">
+{sessionvars%hiddenformentry}
+<p><input name="rev" id="search1" type="text" size="30" /></p>
+<div id="hint">find changesets by author, revision,
+files, or words in the commit message</div>
+</form>
+<pre>
+{doc|escape}
+</pre>
+</div>
+</div>
+
+{footer}
diff --git a/mercurial/templates/paper/helptopics.tmpl b/mercurial/templates/paper/helptopics.tmpl
new file mode 100644
--- /dev/null
+++ b/mercurial/templates/paper/helptopics.tmpl
@@ -0,0 +1,48 @@
+{header}
+<title>Help: {title}</title>
+<link rel="alternate" type="application/atom+xml"
+   href="{url}atom-tags" title="Atom feed for {repo|escape}: branches" />
+<link rel="alternate" type="application/rss+xml"
+   href="{url}rss-tags" title="RSS feed for {repo|escape}: branches" />
+</head>
+<body>
+
+<div class="container">
+<div class="menu">
+<div class="logo">
+<a href="http://mercurial.selenic.com/">
+<img src="{staticurl}hglogo.png" alt="mercurial" /></a>
+</div>
+<ul>
+<li><a href="{url}shortlog{sessionvars%urlparameter}">log</a></li>
+<li><a href="{url}graph{sessionvars%urlparameter}">graph</a></li>
+<li><a href="{url}tags{sessionvars%urlparameter}">tags</a></li>
+<li><a href="{url}branches{sessionvars%urlparameter}">branches</a></li>
+</ul>
+<ul>
+<li class="active">help</li>
+</ul>
+</div>
+
+<div class="main">
+<h2><a href="{url}{sessionvars%urlparameter}">{repo|escape}</a></h2>
+<form class="search" action="{url}log">
+{sessionvars%hiddenformentry}
+<p><input name="rev" id="search1" type="text" size="30" /></p>
+<div id="hint">find changesets by author, revision,
+files, or words in the commit message</div>
+</form>
+<table class="bigtable">
+<tr><td colspan="2"><h2><a name="main" href="#topics">Topics</a></h2></td></tr>
+{topics % helpentry}
+
+<tr><td colspan="2"><h2><a name="main" href="#main">Main Commands</a></h2></td></tr>
+{earlycommands % helpentry}
+
+<tr><td colspan="2"><h2><a name="other" href="#other">Other Commands</a></h2></td></tr>
+{othercommands % helpentry}
+</table>
+</div>
+</div>
+
+{footer}
diff --git a/mercurial/templates/paper/manifest.tmpl b/mercurial/templates/paper/manifest.tmpl
--- a/mercurial/templates/paper/manifest.tmpl
+++ b/mercurial/templates/paper/manifest.tmpl
@@ -22,6 +22,9 @@
 <ul>
 {archives%archiveentry}
 </ul>
+<ul>
+ <li><a href="{url}help{sessionvars%urlparameter}">help</a></li>
+</ul>
 </div>
 
 <div class="main">
diff --git a/mercurial/templates/paper/map b/mercurial/templates/paper/map
--- a/mercurial/templates/paper/map
+++ b/mercurial/templates/paper/map
@@ -9,6 +9,10 @@
 shortlog = shortlog.tmpl
 shortlogentry = shortlogentry.tmpl
 graph = graph.tmpl
+help = help.tmpl
+helptopics = helptopics.tmpl
+
+helpentry = '<tr><td><a href="{url}help/{topic|escape}{sessionvars%urlparameter}">{topic|escape}</a></td><td>{summary|escape}</td></tr>'
 
 naventry = '<a href="{url}log/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
 navshortentry = '<a href="{url}shortlog/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
diff --git a/mercurial/templates/paper/shortlog.tmpl b/mercurial/templates/paper/shortlog.tmpl
--- a/mercurial/templates/paper/shortlog.tmpl
+++ b/mercurial/templates/paper/shortlog.tmpl
@@ -26,6 +26,9 @@
 <ul>
 {archives%archiveentry}
 </ul>
+<ul>
+ <li><a href="{url}help{sessionvars%urlparameter}">help</a></li>
+</ul>
 </div>
 
 <div class="main">
diff --git a/mercurial/templates/paper/tags.tmpl b/mercurial/templates/paper/tags.tmpl
--- a/mercurial/templates/paper/tags.tmpl
+++ b/mercurial/templates/paper/tags.tmpl
@@ -19,6 +19,9 @@
 <li class="active">tags</li>
 <li><a href="{url}branches{sessionvars%urlparameter}">branches</a></li>
 </ul>
+<ul>
+<li><a href="{url}help{sessionvars%urlparameter}">help</a></li>
+</ul>
 </div>
 
 <div class="main">
diff --git a/mercurial/templates/static/style-monoblue.css b/mercurial/templates/static/style-monoblue.css
--- a/mercurial/templates/static/style-monoblue.css
+++ b/mercurial/templates/static/style-monoblue.css
@@ -83,7 +83,7 @@
     margin: 10px 0 0 0;
     list-style-type: none;
     overflow: hidden;
-    width: 800px;
+    width: 900px;
   }
     ul.page-nav li {
       margin: 0 2px 0 0;
diff --git a/tests/test-hgweb-commands.t b/tests/test-hgweb-commands.t
--- a/tests/test-hgweb-commands.t
+++ b/tests/test-hgweb-commands.t
@@ -205,6 +205,7 @@
   <li><a href="/graph/1d22e65f027e">graph</a></li>
   <li><a href="/tags">tags</a></li>
   <li><a href="/branches">branches</a></li>
+  <li><a href="/help">help</a></li>
   </ul>
   <ul>
   <li><a href="/rev/1d22e65f027e">changeset</a></li>
@@ -294,6 +295,7 @@
    <li><a href="/graph/2ef0ac749a14">graph</a></li>
    <li><a href="/tags">tags</a></li>
    <li><a href="/branches">branches</a></li>
+   <li><a href="/help">help</a></li>
   </ul>
   <ul>
    <li class="active">changeset</li>
diff --git a/tests/test-hgweb-descend-empties.t b/tests/test-hgweb-descend-empties.t
--- a/tests/test-hgweb-descend-empties.t
+++ b/tests/test-hgweb-descend-empties.t
@@ -52,6 +52,7 @@
   <li><a href="/graph/9087c84a0f5d">graph</a></li>
   <li><a href="/tags">tags</a></li>
   <li><a href="/branches">branches</a></li>
+  <li><a href="/help">help</a></li>
   </ul>
   <ul>
   <li><a href="/rev/9087c84a0f5d">changeset</a></li>
diff --git a/tests/test-hgweb-diffs.t b/tests/test-hgweb-diffs.t
--- a/tests/test-hgweb-diffs.t
+++ b/tests/test-hgweb-diffs.t
@@ -44,6 +44,7 @@
    <li><a href="/graph/0cd96de13884">graph</a></li>
    <li><a href="/tags">tags</a></li>
    <li><a href="/branches">branches</a></li>
+   <li><a href="/help">help</a></li>
   </ul>
   <ul>
    <li class="active">changeset</li>
@@ -263,6 +264,7 @@
    <li><a href="/graph/0cd96de13884">graph</a></li>
    <li><a href="/tags">tags</a></li>
    <li><a href="/branches">branches</a></li>
+   <li><a href="/help">help</a></li>
   </ul>
   <ul>
    <li class="active">changeset</li>
diff --git a/tests/test-hgweb-empty.t b/tests/test-hgweb-empty.t
--- a/tests/test-hgweb-empty.t
+++ b/tests/test-hgweb-empty.t
@@ -33,6 +33,7 @@
   <li><a href="/graph/000000000000">graph</a></li>
   <li><a href="/tags">tags</a></li>
   <li><a href="/branches">branches</a></li>
+  <li><a href="/help">help</a></li>
   </ul>
   <ul>
   <li><a href="/rev/000000000000">changeset</a></li>
@@ -112,6 +113,7 @@
   <li><a href="/graph/000000000000">graph</a></li>
   <li><a href="/tags">tags</a></li>
   <li><a href="/branches">branches</a></li>
+  <li><a href="/help">help</a></li>
   </ul>
   <ul>
   <li><a href="/rev/000000000000">changeset</a></li>
@@ -192,6 +194,7 @@
   <li class="active">graph</li>
   <li><a href="/tags">tags</a></li>
   <li><a href="/branches">branches</a></li>
+  <li><a href="/help">help</a></li>
   </ul>
   <ul>
   <li><a href="/rev/000000000000">changeset</a></li>
@@ -332,6 +335,7 @@
   <li><a href="/graph/000000000000">graph</a></li>
   <li><a href="/tags">tags</a></li>
   <li><a href="/branches">branches</a></li>
+  <li><a href="/help">help</a></li>
   </ul>
   <ul>
   <li><a href="/rev/000000000000">changeset</a></li>
diff --git a/tests/test-hgweb-removed.t b/tests/test-hgweb-removed.t
--- a/tests/test-hgweb-removed.t
+++ b/tests/test-hgweb-removed.t
@@ -39,6 +39,7 @@
    <li><a href="/graph/c78f6c5cbea9">graph</a></li>
    <li><a href="/tags">tags</a></li>
    <li><a href="/branches">branches</a></li>
+   <li><a href="/help">help</a></li>
   </ul>
   <ul>
    <li class="active">changeset</li>
diff --git a/tests/test-hgweb.t b/tests/test-hgweb.t
--- a/tests/test-hgweb.t
+++ b/tests/test-hgweb.t
@@ -213,6 +213,7 @@
   <li><a href="/graph/2ef0ac749a14">graph</a></li>
   <li><a href="/tags">tags</a></li>
   <li><a href="/branches">branches</a></li>
+  <li><a href="/help">help</a></li>
   </ul>
   <ul>
   <li><a href="/rev/2ef0ac749a14">changeset</a></li>


More information about the Mercurial-devel mailing list