diff --git a/mercurial/help/templates.txt b/mercurial/help/templates.txt --- a/mercurial/help/templates.txt +++ b/mercurial/help/templates.txt @@ -60,6 +60,8 @@ In addition to filters, there are some b - sub(pat, repl, expr) +- rstdoc(text, style) + Also, for any expression that returns a list, there is a list operator: - expr % "{template}" diff --git a/mercurial/hgweb/webcommands.py b/mercurial/hgweb/webcommands.py --- a/mercurial/hgweb/webcommands.py +++ b/mercurial/hgweb/webcommands.py @@ -993,11 +993,9 @@ def help(web, req, tmpl): othercommands=othercommands, title='Index') u = webutil.wsgiui() - u.pushbuffer() u.verbose = True try: - commands.help_(u, topicname) + doc = helpmod.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/templater.py b/mercurial/templater.py --- a/mercurial/templater.py +++ b/mercurial/templater.py @@ -9,6 +9,7 @@ from i18n import _ import sys, os, re import util, config, templatefilters, parser, error import types +import minirst # template parsing @@ -287,6 +288,16 @@ def label(context, mapping, args): t = stringify(args[1][0](context, mapping, args[1][1])) yield runtemplate(context, mapping, compiletemplate(t, context)) +def rstdoc(context, mapping, args): + if len(args) != 2: + # i18n: "rstdoc" is a keyword + raise error.ParseError(_("rstdoc expects two arguments")) + + text = stringify(args[0][0](context, mapping, args[0][1])) + style = stringify(args[1][0](context, mapping, args[1][1])) + + return minirst.format(text, style=style) + methods = { "string": lambda e, c: (runstring, e[1]), "symbol": lambda e, c: (runsymbol, e[1]), @@ -303,6 +314,7 @@ funcs = { "ifeq": ifeq, "join": join, "label": label, + "rstdoc": rstdoc, "sub": sub, } diff --git a/mercurial/templates/gitweb/help.tmpl b/mercurial/templates/gitweb/help.tmpl --- a/mercurial/templates/gitweb/help.tmpl +++ b/mercurial/templates/gitweb/help.tmpl @@ -27,8 +27,8 @@ help
 
-
-{doc|escape}
-
+
+{rstdoc(doc, "html")} +
{footer} diff --git a/mercurial/templates/monoblue/help.tmpl b/mercurial/templates/monoblue/help.tmpl --- a/mercurial/templates/monoblue/help.tmpl +++ b/mercurial/templates/monoblue/help.tmpl @@ -31,8 +31,8 @@ -
-    {doc|escape}
-    
+
+ {rstdoc(doc, "html")} +
{footer} diff --git a/mercurial/templates/paper/help.tmpl b/mercurial/templates/paper/help.tmpl --- a/mercurial/templates/paper/help.tmpl +++ b/mercurial/templates/paper/help.tmpl @@ -31,9 +31,9 @@
find changesets by author, revision, files, or words in the commit message
-
-{doc|escape}
-
+
+{rstdoc(doc, "html")} +
diff --git a/tests/test-help.t b/tests/test-help.t --- a/tests/test-help.t +++ b/tests/test-help.t @@ -1503,65 +1503,65 @@ Dish up an empty repo; serve it cold.
find changesets by author, revision, files, or words in the commit message
-
+  
+

hg add [OPTION]... [FILE]... - +

+

add the specified files on the next commit - - Schedule files to be version controlled and added to the repository. - - The files will be added to the repository at the next commit. To undo an - add before that, see "hg forget". - - If no names are given, add all files to the repository. - - An example showing how new (unknown) files are added automatically by "hg - add": - - $ ls - foo.c - $ hg status - ? foo.c - $ hg add - adding foo.c - $ hg status - A foo.c - - Returns 0 if all files are successfully added. - +

+

+ Schedule files to be version controlled and added to the + repository. +

+

+ The files will be added to the repository at the next commit. To + undo an add before that, see "hg forget". +

+

+ If no names are given, add all files to the repository. +

+

+ Returns 0 if all files are successfully added. +

+

options: +

+ + + + + +
-I--include PATTERN [+]include names matching the given patterns
-X--exclude PATTERN [+]exclude names matching the given patterns
-S--subreposrecurse into subrepositories
-n--dry-rundo not perform actions, just print output
+

+ [+] marked option can be specified multiple times +

+

+ global options: +

+ + + + + + + + + + + + + + + + + +
-R--repository REPOrepository root directory or name of overlay bundle file
--cwd DIRchange working directory
-y--noninteractivedo not prompt, automatically pick the first choice for all prompts
-q--quietsuppress output
-v--verboseenable additional output
--config CONFIG [+]set/override config option (use 'section.name=value')
--debugenable debugging output
--debuggerstart debugger
--encoding ENCODEset the charset encoding (default: ascii)
--encodingmode MODEset the charset encoding mode (default: strict)
--tracebackalways print a traceback on exception
--timetime how long the command takes
--profileprint command execution profile
--versionoutput version information and exit
-h--helpdisplay help and exit
--hiddenconsider hidden changesets
+

+ [+] marked option can be specified multiple times +

- -I --include PATTERN [+] include names matching the given patterns - -X --exclude PATTERN [+] exclude names matching the given patterns - -S --subrepos recurse into subrepositories - -n --dry-run do not perform actions, just print output - - [+] marked option can be specified multiple times - - global options: - - -R --repository REPO repository root directory or name of overlay bundle - file - --cwd DIR change working directory - -y --noninteractive do not prompt, automatically pick the first choice for - all prompts - -q --quiet suppress output - -v --verbose enable additional output - --config CONFIG [+] set/override config option (use 'section.name=value') - --debug enable debugging output - --debugger start debugger - --encoding ENCODE set the charset encoding (default: ascii) - --encodingmode MODE set the charset encoding mode (default: strict) - --traceback always print a traceback on exception - --time time how long the command takes - --profile print command execution profile - --version output version information and exit - -h --help display help and exit - --hidden consider hidden changesets - - [+] marked option can be specified multiple times - -
+ @@ -1615,74 +1615,65 @@ Dish up an empty repo; serve it cold.
find changesets by author, revision, files, or words in the commit message
-
+  
+

hg remove [OPTION]... FILE... - +

+

aliases: rm - +

+

remove the specified files on the next commit - - Schedule the indicated files for removal from the current branch. - - This command schedules the files to be removed at the next commit. To undo - a remove before that, see "hg revert". To undo added files, see "hg - forget". - - -A/--after can be used to remove only files that have already been - deleted, -f/--force can be used to force deletion, and -Af can be used to - remove files from the next revision without deleting them from the working - directory. - - The following table details the behavior of remove for different file - states (columns) and option combinations (rows). The file states are Added - [A], Clean [C], Modified [M] and Missing [!] (as reported by "hg status"). - The actions are Warn, Remove (from branch) and Delete (from disk): - - A C M ! - -------------- - none W RD W R - -f R RD RD R - -A W W W R - -Af R R R R - - Note that remove never deletes files in Added [A] state from the working - directory, not even if option --force is specified. +

+

+ Schedule the indicated files for removal from the current branch. +

+

+ This command schedules the files to be removed at the next commit. + To undo a remove before that, see "hg revert". To undo added + files, see "hg forget". +

+

+ Returns 0 on success, 1 if any warnings encountered. +

+

+ options: +

+ + + + + +
-A--afterrecord delete for missing files
-f--forceremove (and delete) file even if added or modified
-I--include PATTERN [+]include names matching the given patterns
-X--exclude PATTERN [+]exclude names matching the given patterns
+

+ [+] marked option can be specified multiple times +

+

+ global options: +

+ + + + + + + + + + + + + + + + + +
-R--repository REPOrepository root directory or name of overlay bundle file
--cwd DIRchange working directory
-y--noninteractivedo not prompt, automatically pick the first choice for all prompts
-q--quietsuppress output
-v--verboseenable additional output
--config CONFIG [+]set/override config option (use 'section.name=value')
--debugenable debugging output
--debuggerstart debugger
--encoding ENCODEset the charset encoding (default: ascii)
--encodingmode MODEset the charset encoding mode (default: strict)
--tracebackalways print a traceback on exception
--timetime how long the command takes
--profileprint command execution profile
--versionoutput version information and exit
-h--helpdisplay help and exit
--hiddenconsider hidden changesets
+

+ [+] marked option can be specified multiple times +

- Returns 0 on success, 1 if any warnings encountered. - - options: - - -A --after record delete for missing files - -f --force remove (and delete) file even if added or modified - -I --include PATTERN [+] include names matching the given patterns - -X --exclude PATTERN [+] exclude names matching the given patterns - - [+] marked option can be specified multiple times - - global options: - - -R --repository REPO repository root directory or name of overlay bundle - file - --cwd DIR change working directory - -y --noninteractive do not prompt, automatically pick the first choice for - all prompts - -q --quiet suppress output - -v --verbose enable additional output - --config CONFIG [+] set/override config option (use 'section.name=value') - --debug enable debugging output - --debugger start debugger - --encoding ENCODE set the charset encoding (default: ascii) - --encodingmode MODE set the charset encoding mode (default: strict) - --traceback always print a traceback on exception - --time time how long the command takes - --profile print command execution profile - --version output version information and exit - -h --help display help and exit - --hidden consider hidden changesets - - [+] marked option can be specified multiple times - -
+ @@ -1736,38 +1727,50 @@ Dish up an empty repo; serve it cold.
find changesets by author, revision, files, or words in the commit message
-
+  
+

Specifying Single Revisions - - Mercurial supports several ways to specify individual revisions. - - A plain integer is treated as a revision number. Negative integers are - treated as sequential offsets from the tip, with -1 denoting the tip, -2 - denoting the revision prior to the tip, and so forth. - - A 40-digit hexadecimal string is treated as a unique revision identifier. - - A hexadecimal string less than 40 characters long is treated as a unique - revision identifier and is referred to as a short-form identifier. A - short-form identifier is only valid if it is the prefix of exactly one - full-length identifier. +

+

+ Mercurial supports several ways to specify individual revisions. +

+

+ A plain integer is treated as a revision number. Negative integers are + treated as sequential offsets from the tip, with -1 denoting the tip, + -2 denoting the revision prior to the tip, and so forth. +

+

+ A 40-digit hexadecimal string is treated as a unique revision + identifier. +

+

+ A hexadecimal string less than 40 characters long is treated as a + unique revision identifier and is referred to as a short-form + identifier. A short-form identifier is only valid if it is the prefix + of exactly one full-length identifier. +

+

+ Any other string is treated as a bookmark, tag, or branch name. A + bookmark is a movable pointer to a revision. A tag is a permanent name + associated with a revision. A branch name denotes the tipmost revision + of that branch. Bookmark, tag, and branch names must not contain the ":" + character. +

+

+ The reserved name "tip" always identifies the most recent revision. +

+

+ The reserved name "null" indicates the null revision. This is the + revision of an empty repository, and the parent of revision 0. +

+

+ 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. +

- Any other string is treated as a bookmark, tag, or branch name. A bookmark - is a movable pointer to a revision. A tag is a permanent name associated - with a revision. A branch name denotes the tipmost revision of that - branch. Bookmark, tag, and branch names must not contain the ":" - character. - - The reserved name "tip" always identifies the most recent revision. - - The reserved name "null" indicates the null revision. This is the revision - of an empty repository, and the parent of revision 0. - - 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. - -
+