[PATCH] issue1714: atom: xmlescape

Nicolas Dumazet nicdumz at gmail.com
Sun Jun 28 09:36:37 CDT 2009


# HG changeset patch
# User Nicolas Dumazet <nicdumz.commits at gmail.com>
# Date 1246198718 -32400
# Node ID d27134fb1119410f51fee4e7aa89c3a9008036aa
# Parent  835a51e63c5b0e4eee4f95fcbbdaf4476629a621
atom: Use xmlescape instead of escape (issue1714)

diff --git a/templates/atom/changelog.tmpl b/templates/atom/changelog.tmpl
--- a/templates/atom/changelog.tmpl
+++ b/templates/atom/changelog.tmpl
@@ -3,7 +3,7 @@
  <id>{urlbase}{url}</id>
  <link rel="self" href="{urlbase}{url}atom-log"/>
  <link rel="alternate" href="{urlbase}{url}"/>
- <title>{repo|escape} Changelog</title>
+ <title>{repo|xmlescape} Changelog</title>
  {latestentry%feedupdated}
 
 {entries%changelogentry}
diff --git a/templates/atom/changelogentry.tmpl b/templates/atom/changelogentry.tmpl
--- a/templates/atom/changelogentry.tmpl
+++ b/templates/atom/changelogentry.tmpl
@@ -1,16 +1,16 @@
  <entry>
-  <title>{desc|strip|firstline|strip|escape|nonempty}</title>
+  <title>{desc|strip|firstline|strip|xmlescape|nonempty}</title>
   <id>{urlbase}{url}#changeset-{node}</id>
   <link href="{urlbase}{url}rev/{node}"/>
   <author>
-   <name>{author|person|escape}</name>
+   <name>{author|person|xmlescape}</name>
    <email>{author|email|obfuscate}</email>
   </author>
   <updated>{date|rfc3339date}</updated>
   <published>{date|rfc3339date}</published>
   <content type="xhtml">
    <div xmlns="http://www.w3.org/1999/xhtml">
-    <pre xml:space="preserve">{desc|escape|nonempty}</pre>
+    <pre xml:space="preserve">{desc|xmlescape|nonempty}</pre>
    </div>
   </content>
  </entry>
diff --git a/templates/atom/error.tmpl b/templates/atom/error.tmpl
--- a/templates/atom/error.tmpl
+++ b/templates/atom/error.tmpl
@@ -12,6 +12,6 @@
     <name>mercurial</name>
   </author>
   <updated>1970-01-01T00:00:00+00:00</updated>
-  <content type="text">{error|escape}</content>
+  <content type="text">{error|xmlescape}</content>
  </entry>
 </feed>
diff --git a/templates/atom/filelog.tmpl b/templates/atom/filelog.tmpl
--- a/templates/atom/filelog.tmpl
+++ b/templates/atom/filelog.tmpl
@@ -1,7 +1,7 @@
 {header}
- <id>{urlbase}{url}atom-log/tip/{file|escape}</id>
- <link rel="self" href="{urlbase}{url}atom-log/tip/{file|escape}"/>
- <title>{repo|escape}: {file|escape} history</title>
+ <id>{urlbase}{url}atom-log/tip/{file|xmlescape}</id>
+ <link rel="self" href="{urlbase}{url}atom-log/tip/{file|xmlescape}"/>
+ <title>{repo|xmlescape}: {file|xmlescape} history</title>
  {latestentry%feedupdated}
 
 {entries%changelogentry}
diff --git a/templates/atom/tagentry.tmpl b/templates/atom/tagentry.tmpl
--- a/templates/atom/tagentry.tmpl
+++ b/templates/atom/tagentry.tmpl
@@ -1,8 +1,8 @@
  <entry>
-  <title>{tag|escape}</title>
+  <title>{tag|xmlescape}</title>
   <link rel="alternate" href="{urlbase}{url}rev/{node}"/>
   <id>{urlbase}{url}#tag-{node}</id>
   <updated>{date|rfc3339date}</updated>
   <published>{date|rfc3339date}</published>
-  <content type="text">{tag|strip|escape}</content>
+  <content type="text">{tag|strip|xmlescape}</content>
  </entry>
diff --git a/templates/atom/tags.tmpl b/templates/atom/tags.tmpl
--- a/templates/atom/tags.tmpl
+++ b/templates/atom/tags.tmpl
@@ -2,8 +2,8 @@
  <id>{urlbase}{url}</id>
  <link rel="self" href="{urlbase}{url}atom-tags"/>
  <link rel="alternate" href="{urlbase}{url}tags"/>
- <title>{repo|escape}: tags</title>
- <summary>{repo|escape} tag history</summary>
+ <title>{repo|xmlescape}: tags</title>
+ <summary>{repo|xmlescape} tag history</summary>
  <author><name>Mercurial SCM</name></author>
  {latestentry%feedupdated}
 
diff --git a/tests/test-hgweb-commands b/tests/test-hgweb-commands
--- a/tests/test-hgweb-commands
+++ b/tests/test-hgweb-commands
@@ -15,7 +15,7 @@
 hg tag 1.0
 echo another > foo
 hg branch stable
-hg ci -Ambranch
+hg ci -Am "branch with nasty<> '\"characters"
 hg serve -n test -p $HGPORT -d --pid-file=hg.pid -E errors.log
 cat hg.pid >> $DAEMON_PIDS
 
diff --git a/tests/test-hgweb-commands.out b/tests/test-hgweb-commands.out
--- a/tests/test-hgweb-commands.out
+++ b/tests/test-hgweb-commands.out
@@ -15,9 +15,9 @@
  <updated>1970-01-01T00:00:00+00:00</updated>
 
  <entry>
-  <title>branch</title>
-  <id>http://127.0.0.1/#changeset-1d22e65f027e5a0609357e7d8e7508cd2ba5d2fe</id>
-  <link href="http://127.0.0.1/rev/1d22e65f027e5a0609357e7d8e7508cd2ba5d2fe"/>
+  <title>branch with nasty&lt;&gt; &#39;&quot;characters</title>
+  <id>http://127.0.0.1/#changeset-292c77fd53f19766afcadfde932f6e4dbf5221a2</id>
+  <link href="http://127.0.0.1/rev/292c77fd53f19766afcadfde932f6e4dbf5221a2"/>
   <author>
    <name>test</name>
    <email>&#116;&#101;&#115;&#116;</email>
@@ -26,7 +26,7 @@
   <published>1970-01-01T00:00:00+00:00</published>
   <content type="xhtml">
    <div xmlns="http://127.0.0.1/1999/xhtml">
-    <pre xml:space="preserve">branch</pre>
+    <pre xml:space="preserve">branch with nasty&lt;&gt; &#39;&quot;characters</pre>
    </div>
   </content>
  </entry>
@@ -76,9 +76,9 @@
  <updated>1970-01-01T00:00:00+00:00</updated>
 
  <entry>
-  <title>branch</title>
-  <id>http://127.0.0.1/#changeset-1d22e65f027e5a0609357e7d8e7508cd2ba5d2fe</id>
-  <link href="http://127.0.0.1/rev/1d22e65f027e5a0609357e7d8e7508cd2ba5d2fe"/>
+  <title>branch with nasty&lt;&gt; &#39;&quot;characters</title>
+  <id>http://127.0.0.1/#changeset-292c77fd53f19766afcadfde932f6e4dbf5221a2</id>
+  <link href="http://127.0.0.1/rev/292c77fd53f19766afcadfde932f6e4dbf5221a2"/>
   <author>
    <name>test</name>
    <email>&#116;&#101;&#115;&#116;</email>
@@ -87,7 +87,7 @@
   <published>1970-01-01T00:00:00+00:00</published>
   <content type="xhtml">
    <div xmlns="http://127.0.0.1/1999/xhtml">
-    <pre xml:space="preserve">branch</pre>
+    <pre xml:space="preserve">branch with nasty&lt;&gt; &#39;&quot;characters</pre>
    </div>
   </content>
  </entry>
@@ -177,13 +177,13 @@
 </div>
 <ul>
 <li class="active">log</li>
-<li><a href="/graph/1d22e65f027e">graph</a></li>
+<li><a href="/graph/292c77fd53f1">graph</a></li>
 <li><a href="/tags">tags</a></li>
 <li><a href="/branches">branches</a></li>
 </ul>
 <ul>
-<li><a href="/rev/1d22e65f027e">changeset</a></li>
-<li><a href="/file/1d22e65f027e">browse</a></li>
+<li><a href="/rev/292c77fd53f1">changeset</a></li>
+<li><a href="/file/292c77fd53f1">browse</a></li>
 </ul>
 <ul>
 
@@ -212,7 +212,7 @@
  <tr class="parity0">
   <td class="age">many years</td>
   <td class="author">test</td>
-  <td class="description"><a href="/rev/1d22e65f027e">branch</a><span class="branchhead">stable</span> <span class="tag">tip</span> </td>
+  <td class="description"><a href="/rev/292c77fd53f1">branch with nasty&lt;&gt; '&quot;characters</a><span class="branchhead">stable</span> <span class="tag">tip</span> </td>
  </tr>
  <tr class="parity1">
   <td class="age">many years</td>
@@ -428,7 +428,7 @@
 </tr>
 <tr>
  <th class="author">children</th>
- <td class="author"><a href="/file/1d22e65f027e/foo">1d22e65f027e</a> </td>
+ <td class="author"><a href="/file/292c77fd53f1/foo">292c77fd53f1</a> </td>
 </tr>
 
 </table>
@@ -512,7 +512,7 @@
 <a href="/graph?style=gitweb">graph</a> |
 <a href="/tags?style=gitweb">tags</a> |
 branches |
-<a href="/file/1d22e65f027e?style=gitweb">files</a>
+<a href="/file/292c77fd53f1?style=gitweb">files</a>
 <br/>
 </div>
 
@@ -521,12 +521,12 @@
 
 <tr class="parity0">
 <td class="age"><i>many years ago</i></td>
-<td><a class="list" href="/shortlog/1d22e65f027e?style=gitweb"><b>1d22e65f027e</b></a></td>
+<td><a class="list" href="/shortlog/292c77fd53f1?style=gitweb"><b>292c77fd53f1</b></a></td>
 <td class="open">stable</td>
 <td class="link">
-<a href="/changeset/1d22e65f027e?style=gitweb">changeset</a> |
-<a href="/log/1d22e65f027e?style=gitweb">changelog</a> |
-<a href="/file/1d22e65f027e?style=gitweb">files</a>
+<a href="/changeset/292c77fd53f1?style=gitweb">changeset</a> |
+<a href="/log/292c77fd53f1?style=gitweb">changelog</a> |
+<a href="/file/292c77fd53f1?style=gitweb">files</a>
 </td>
 </tr>
 <tr class="parity1">
@@ -590,7 +590,7 @@
 <a href="/graph?style=gitweb">graph</a> |
 <a href="/tags?style=gitweb">tags</a> |
 <a href="/branches?style=gitweb">branches</a> |
-<a href="/file/1d22e65f027e?style=gitweb">files</a>
+<a href="/file/292c77fd53f1?style=gitweb">files</a>
 <br/>
 </div>
 
@@ -608,14 +608,14 @@
 <td class="age"><i>many years ago</i></td>
 <td><i>test</i></td>
 <td>
-<a class="list" href="/rev/1d22e65f027e?style=gitweb">
-<b>branch</b>
+<a class="list" href="/rev/292c77fd53f1?style=gitweb">
+<b>branch with nasty&lt;&gt; '&quot;characters</b>
 <span class="logtags"><span class="branchtag" title="stable">stable</span> <span class="tagtag" title="tip">tip</span> </span>
 </a>
 </td>
 <td class="link" nowrap>
-<a href="/rev/1d22e65f027e?style=gitweb">changeset</a> |
-<a href="/file/1d22e65f027e?style=gitweb">files</a>
+<a href="/rev/292c77fd53f1?style=gitweb">changeset</a> |
+<a href="/file/292c77fd53f1?style=gitweb">files</a>
 </td>
 </tr>
 <tr class="parity1">
@@ -669,12 +669,12 @@
 
 <tr class="parity0">
 <td class="age"><i>many years ago</i></td>
-<td><a class="list" href="/shortlog/1d22e65f027e?style=gitweb"><b>1d22e65f027e</b></a></td>
+<td><a class="list" href="/shortlog/292c77fd53f1?style=gitweb"><b>292c77fd53f1</b></a></td>
 <td class="">stable</td>
 <td class="link">
-<a href="/changeset/1d22e65f027e?style=gitweb">changeset</a> |
-<a href="/log/1d22e65f027e?style=gitweb">changelog</a> |
-<a href="/file/1d22e65f027e?style=gitweb">files</a>
+<a href="/changeset/292c77fd53f1?style=gitweb">changeset</a> |
+<a href="/log/292c77fd53f1?style=gitweb">changelog</a> |
+<a href="/file/292c77fd53f1?style=gitweb">files</a>
 </td>
 </tr>
 <tr class="parity1">
@@ -740,7 +740,7 @@
 graph |
 <a href="/tags?style=gitweb">tags</a> |
 <a href="/branches?style=gitweb">branches</a> |
-<a href="/file/1d22e65f027e?style=gitweb">files</a>
+<a href="/file/292c77fd53f1?style=gitweb">files</a>
 <br/>
 <a href="/graph/2?style=gitweb&revcount=12">less</a>
 <a href="/graph/2?style=gitweb&revcount=50">more</a>
@@ -761,7 +761,7 @@
 <script>
 <!-- hide script content
 
-var data = [["1d22e65f027e", [0, 1], [[0, 0, 1]], "branch", "test", "many years", ["stable", true], ["tip"]], ["a4f92ed23982", [0, 1], [[0, 0, 1]], "Added tag 1.0 for changeset 2ef0ac749a14", "test", "many years", ["default", true], []], ["2ef0ac749a14", [0, 1], [], "base", "test", "many years", ["default", false], ["1.0"]]];
+var data = [["292c77fd53f1", [0, 1], [[0, 0, 1]], "branch with nasty&lt;&gt; '\"characters", "test", "many years", ["stable", true], ["tip"]], ["a4f92ed23982", [0, 1], [[0, 0, 1]], "Added tag 1.0 for changeset 2ef0ac749a14", "test", "many years", ["default", true], []], ["2ef0ac749a14", [0, 1], [], "base", "test", "many years", ["default", false], ["1.0"]]];
 var graph = new Graph();
 graph.scale(39);
 
@@ -851,7 +851,7 @@
 lookup changegroupsubset branchmap unbundle=HG10GZ,HG10BZ,HG10UN% heads
 200 Script output follows
 
-1d22e65f027e5a0609357e7d8e7508cd2ba5d2fe
+292c77fd53f19766afcadfde932f6e4dbf5221a2
 % lookup
 200 Script output follows
 
@@ -859,15 +859,13 @@
 % branches
 200 Script output follows
 
-1d22e65f027e5a0609357e7d8e7508cd2ba5d2fe 2ef0ac749a14e4f57a5a822464a0902c6f7f448f 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000
+292c77fd53f19766afcadfde932f6e4dbf5221a2 2ef0ac749a14e4f57a5a822464a0902c6f7f448f 0000000000000000000000000000000000000000 0000000000000000000000000000000000000000
 % changegroup
 200 Script output follows
 
-x\x9c\xbdTMHUA\x14\xbe\xa8\xf9\xec\xda&\x10\x11*\xb8\x88\x81\x99\xbef\xe6\xce\xbdw\xc6\xf2a\x16E\x1b\x11[%\x98\xcc\xaf\x8f\x8c\xf7\xc0\xf7\x82
-4\x11KP2m\x95\xad*\xabE\x05AP\xd0\xc22Z\x14\xf9\x03\xb9j\xa3\x9b$\xa4MJ\xb4\x90\xc0\x9a\x9bO0\x10\xdf\x13\xa2\x81\x0f\x869g\xe6|\xe7\x9c\xef\x8ceY\xf7\xa2KO\xd2\xb7K\x16~\
-\xe9\xad\x90w\x86\xab\x93W\x8e\xdf\xb0r\\Y\xee6(\xa2)\xf6\x95\xc6\x01\xe4\x1az\x80R\xe8kN\x98\xe7R\xa4\xa9K@\xe0!A\xb4k\xa7U*m\x03\x07\xd8\x92\x1d\xd2\xc9\xa4\x1d\xc2\xe6,\xa5\xcc+\x1f\xef\xafDgi\xef\xab\x1d\x1d\xb7\x9a\xe7[W\xfbc\x8f\xde-\xcd\xe7\xcaz\xb3\xbb\x19\xd3\x81\x10>c>\x08\x00"X\x11\xc2\x84@\xd2\xe7B*L\x00\x01P\x04R\xc3@\xbaB0\xdb8#\x83:\x83\xa2h\xbc=\xcd\xdaS\xe1Y,L\xd3\xa0\xf2\xa8\x94J:\xe6\xd8\x81Q\xe0\xe8d\xa7#\xe2,\xd1\xaeR*\xed \xa5\x01\x13\x01\xa6\x0cb\xe3;\xbe\xaf\xfcK[^wK\xe1N\xaf\xbbk\xe8B\xd1\xf4\xc1\x07\xb3\xab[\x10\xfdkmvwcB\xa6\xa4\xd4G\xc4D\xc2\x141\xad\x91\x10\x00\x08J\x81\xcb}\xee\t\xee+W\xba\x8a\x80\x90|\xd4\xa0\xd6\xa0\xd4T\xde\xe1\x9d,!\xe2\xb5\xa94\xe3\xe7\xd5\x9f\x06\x18\xcba\x03aP\xb8f\xcd\x04\x1a_\\9\xf1\xed\xe4\x9e\xe5\xa6\xd1\xd2\x9f\x03\xa7o\xae\x90H\xf3\xfb\xef\xffH3\xadk
-\xb0\x90\x92\x88\xb9\x14"\x068\xc2\x1e@\x00\xbb\x8a)\xd3\'\x859
-\xa8\x80\x84S \xa5\xbd-g\x13`\xe4\xdc\xc3H^\xdf\xe2\xc0TM\xc7\xf4BO\xcf\xde\xae\xe5\xae#\x1frM(K\x97`F\x19\x16s\x05GD\xb9\x01\xc1\x00+\x8c|\x9fp\xc11\xf0\x14\x00\x9cJ\x82<\xe0\x12\x9f\xc1\x90\xd0\xf5\xc8\x19>Pr\xaa\xeaW\xf5\xc4\xae\xd1\xfc\x17\xcf\'\x13u\xb1\x9e\xcdHnC\x0e\xcc`\xc8\xa0&\xac\x0e\xf1|\x8c\x10$\xc4\x8c\xa2p\x05`\xdc\x08 \x80\xc4\xd7Rr-\x94\x10\x102\xedi;\xf3f\xf1z\x16\x86\xdb\xd8d\xe5\xe7\x8b\xf5\x8d\rzp\xb2\xfe\xac\xf5\xf2\xd3\xfe\xfckws\xedt\x96b\xd5l\x1c\x0b\x85\xb5\x170\x8f\x11\x84\xb0\x8f\x19\xa0\x00\t_\x07\x1ac\xa2\xc3\x89Z\xe7\x96\xf9 \xccNFg\xc7F\xaa\x8a+\x9a\x9cc_\x17\x1b\x17\x9e]z38<\x97+\xb5,",\xc8\xc8?\\\x91\xff\x17.~U\x96\x97\xf5%\xdeN<\x8e\xf5\x97%\xe7^\xcfL\xed~\xda\x96k\xdc->\x86\x02\x83"\x96H\xa6\xe3\xaas=-\xeb7\xe5\xda\x8f\xbc
+x\x9c\xbdTMHUA\x14\xbe\xa4\xf1\xe4\xda&\x10\x11jq\x13#\x15}\xce\x9d;\xf7\xde\x19\xd3\x87Y\x14-\x12\xd1U\x81\xc5\xfc\xfa\xcax\x0f\xde\xbb`\x06\x92\x88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#\xa9\xd4\x1d\x94\x88A\x9fp\x1b3\x02\x840\xb7d\xac\x03\x0c\x9f\xb9\x17\xd9\xd6\xb740S\xdd1\xbb\xd8\xd3\xb3\xbb{\xa5\xbbn*\xd7\x84\xb2\xf4\xcf\xce\xcc\x8cA\x1d\xce \x96\x8e\x8f\x11@\x12A\xcf\xc3\x8c3\x04\\\t\x00#\x02C\x178\xd8\xa3vH\xe8r\xe48\x1b(:Z\xf9\xb3jr\xc7H\xde\x93\xc7\xd3\x89\xfaX\xcfF$\xb70(T\xe3\x8aFuX\x1d\xecz\x08B\x1bc\xbd\xa4\xdc\xe1\x802=\x1a\xbe\x8d=%\x04S\\rn\xdbT\xb9\xca\xcc\xbcY\xb8\x96\x85\xe666]\xfe\xf1\\CS\xa3\x1a\x9cn8i<}\xbf7\xef\xd2\x9d\\;\x9d\xa5X\xd5\xeb\x17F"\xe5\xfa\xd4\xa5\x18B\xe4!
+\x08\x80\xdcS\xbeB\x08\xabp\xd7\xd6\xb8e\xbe\x0e}\x12\xd1\xb9\xb1\xe1\xca\xc2\xb2f\xeb\xe0\xa7\xa5\xa6\xc5G]/\x06\x87\xe6s\xa5\x96e\x08\xf33\x8b\x11J\xe4\xff\x85\x8b_\x14\xa5%}\x89\x97\x93\x0fb\xfd%\xc9\xf9\x8973;\xc7O\xe5\x1aw\x93/#_\xa3\x80&\x92A\\\xa6\xd6\xd22~\x01\xb87\xa3\x0e
 % stream_out
 200 Script output follows
 


More information about the Mercurial-devel mailing list