[PATCH 1 of 6] hgweb: test help functionality

Dan Villiom Podlaski Christiansen danchr at gmail.com
Sat Feb 9 07:00:35 CST 2013


# HG changeset patch
# User Dan Villiom Podlaski Christiansen  <danchr at gmail.com>
# Date 1360414099 0
# Node ID 9e480fad47e71fd9b954159cad337e8b91a5b9e5
# Parent  d8cfe29c6b612fe6e250afdd7219eb4d461b9e3e
hgweb: test help functionality

we tweak the templates a bit to make the output more greppable

diff --git a/mercurial/templates/coal/map b/mercurial/templates/coal/map
--- a/mercurial/templates/coal/map
+++ b/mercurial/templates/coal/map
@@ -13,7 +13,14 @@ graph = ../paper/graph.tmpl
 help = ../paper/help.tmpl
 helptopics = ../paper/helptopics.tmpl
 
-helpentry = '<tr><td><a href="{url|urlescape}help/{topic|escape}{sessionvars%urlparameter}">{topic|escape}</a></td><td>{summary|escape}</td></tr>'
+helpentry = '
+  <tr><td>
+    <a href="{url|urlescape}help/{topic|escape}{sessionvars%urlparameter}">
+      {topic|escape}
+    </a>
+  </td><td>
+    {summary|escape}
+  </td></tr>'
 
 naventry = '<a href="{url|urlescape}log/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
 navshortentry = '<a href="{url|urlescape}shortlog/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
diff --git a/mercurial/templates/gitweb/map b/mercurial/templates/gitweb/map
--- a/mercurial/templates/gitweb/map
+++ b/mercurial/templates/gitweb/map
@@ -11,7 +11,14 @@ notfound = notfound.tmpl
 help = help.tmpl
 helptopics = helptopics.tmpl
 
-helpentry = '<tr><td><a href="{url|urlescape}help/{topic|escape}{sessionvars%urlparameter}">{topic|escape}</a></td><td>{summary|escape}</td></tr>'
+helpentry = '
+  <tr><td>
+    <a href="{url|urlescape}help/{topic|escape}{sessionvars%urlparameter}">
+      {topic|escape}
+    </a>
+  </td><td>
+    {summary|escape}
+  </td></tr>'
 
 naventry = '<a href="{url|urlescape}log/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
 navshortentry = '<a href="{url|urlescape}shortlog/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
diff --git a/mercurial/templates/monoblue/map b/mercurial/templates/monoblue/map
--- a/mercurial/templates/monoblue/map
+++ b/mercurial/templates/monoblue/map
@@ -11,7 +11,14 @@ notfound = notfound.tmpl
 help = help.tmpl
 helptopics = helptopics.tmpl
 
-helpentry = '<tr><td><a href="{url|urlescape}help/{topic|escape}{sessionvars%urlparameter}">{topic|escape}</a></td><td>{summary|escape}</td></tr>'
+helpentry = '
+  <tr><td>
+    <a href="{url|urlescape}help/{topic|escape}{sessionvars%urlparameter}">
+      {topic|escape}
+    </a>
+  </td><td>
+    {summary|escape}
+  </td></tr>'
 
 naventry = '<a href="{url|urlescape}log/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
 navshortentry = '<a href="{url|urlescape}shortlog/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
diff --git a/mercurial/templates/paper/map b/mercurial/templates/paper/map
--- a/mercurial/templates/paper/map
+++ b/mercurial/templates/paper/map
@@ -12,7 +12,14 @@ graph = graph.tmpl
 help = help.tmpl
 helptopics = helptopics.tmpl
 
-helpentry = '<tr><td><a href="{url|urlescape}help/{topic|escape}{sessionvars%urlparameter}">{topic|escape}</a></td><td>{summary|escape}</td></tr>'
+helpentry = '
+  <tr><td>
+    <a href="{url|urlescape}help/{topic|escape}{sessionvars%urlparameter}">
+      {topic|escape}
+    </a>
+  </td><td>
+    {summary|escape}
+  </td></tr>'
 
 naventry = '<a href="{url|urlescape}log/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
 navshortentry = '<a href="{url|urlescape}shortlog/{node|short}{sessionvars%urlparameter}">{label|escape}</a> '
diff --git a/tests/test-hgweb-help.t b/tests/test-hgweb-help.t
new file mode 100644
--- /dev/null
+++ b/tests/test-hgweb-help.t
@@ -0,0 +1,330 @@
+  $ "$TESTDIR/hghave" serve || exit 80
+
+Test the help pages in hgweb.
+
+Dish up an empty repo; serve it cold.
+
+  $ hg init test
+  $ cd test
+  $ hg serve -n test -p $HGPORT -d --pid-file=hg.pid
+  $ cat hg.pid >> $DAEMON_PIDS
+
+  $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/add"
+  200 Script output follows
+  
+  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
+  <head>
+  <link rel="icon" href="/static/hgicon.png" type="image/png" />
+  <meta name="robots" content="index, nofollow" />
+  <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
+  <script type="text/javascript" src="/static/mercurial.js"></script>
+  
+  <title>Help: add</title>
+  </head>
+  <body>
+  
+  <div class="container">
+  <div class="menu">
+  <div class="logo">
+  <a href="http://mercurial.selenic.com/">
+  <img src="/static/hglogo.png" alt="mercurial" /></a>
+  </div>
+  <ul>
+  <li><a href="/shortlog">log</a></li>
+  <li><a href="/graph">graph</a></li>
+  <li><a href="/tags">tags</a></li>
+  <li><a href="/bookmarks">bookmarks</a></li>
+  <li><a href="/branches">branches</a></li>
+  </ul>
+  <ul>
+   <li class="active"><a href="/help">help</a></li>
+  </ul>
+  </div>
+  
+  <div class="main">
+  <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
+  <h3>Help: add</h3>
+  
+  <form class="search" action="/log">
+  
+  <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>
+  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.
+  
+  options:
+  
+   -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
+  
+  </pre>
+  </div>
+  </div>
+  
+  <script type="text/javascript">process_dates()</script>
+  
+  
+  </body>
+  </html>
+  
+
+  $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/remove"
+  200 Script output follows
+  
+  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
+  <head>
+  <link rel="icon" href="/static/hgicon.png" type="image/png" />
+  <meta name="robots" content="index, nofollow" />
+  <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
+  <script type="text/javascript" src="/static/mercurial.js"></script>
+  
+  <title>Help: remove</title>
+  </head>
+  <body>
+  
+  <div class="container">
+  <div class="menu">
+  <div class="logo">
+  <a href="http://mercurial.selenic.com/">
+  <img src="/static/hglogo.png" alt="mercurial" /></a>
+  </div>
+  <ul>
+  <li><a href="/shortlog">log</a></li>
+  <li><a href="/graph">graph</a></li>
+  <li><a href="/tags">tags</a></li>
+  <li><a href="/bookmarks">bookmarks</a></li>
+  <li><a href="/branches">branches</a></li>
+  </ul>
+  <ul>
+   <li class="active"><a href="/help">help</a></li>
+  </ul>
+  </div>
+  
+  <div class="main">
+  <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
+  <h3>Help: remove</h3>
+  
+  <form class="search" action="/log">
+  
+  <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>
+  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.
+  
+      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
+  
+  </pre>
+  </div>
+  </div>
+  
+  <script type="text/javascript">process_dates()</script>
+  
+  
+  </body>
+  </html>
+  
+
+  $ "$TESTDIR/get-with-headers.py" 127.0.0.1:$HGPORT "help/revisions"
+  200 Script output follows
+  
+  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+  <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US">
+  <head>
+  <link rel="icon" href="/static/hgicon.png" type="image/png" />
+  <meta name="robots" content="index, nofollow" />
+  <link rel="stylesheet" href="/static/style-paper.css" type="text/css" />
+  <script type="text/javascript" src="/static/mercurial.js"></script>
+  
+  <title>Help: revisions</title>
+  </head>
+  <body>
+  
+  <div class="container">
+  <div class="menu">
+  <div class="logo">
+  <a href="http://mercurial.selenic.com/">
+  <img src="/static/hglogo.png" alt="mercurial" /></a>
+  </div>
+  <ul>
+  <li><a href="/shortlog">log</a></li>
+  <li><a href="/graph">graph</a></li>
+  <li><a href="/tags">tags</a></li>
+  <li><a href="/bookmarks">bookmarks</a></li>
+  <li><a href="/branches">branches</a></li>
+  </ul>
+  <ul>
+   <li class="active"><a href="/help">help</a></li>
+  </ul>
+  </div>
+  
+  <div class="main">
+  <h2 class="breadcrumb"><a href="/">Mercurial</a> </h2>
+  <h3>Help: revisions</h3>
+  
+  <form class="search" action="/log">
+  
+  <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>
+  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.
+  
+      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.
+  
+  </pre>
+  </div>
+  </div>
+  
+  <script type="text/javascript">process_dates()</script>
+  
+  
+  </body>
+  </html>
+  
+
+  $ "$TESTDIR/killdaemons.py" $DAEMON_PIDS


More information about the Mercurial-devel mailing list