diff --git a/mercurial/hgweb.py b/mercurial/hgweb.py
index 1f6c61a6058644f4b51e84f81b026cb7a05fc958_bWVyY3VyaWFsL2hnd2ViLnB5..083c38bdfa6468113b31a7def64e89b00fbd6551_bWVyY3VyaWFsL2hnd2ViLnB5 100644
--- a/mercurial/hgweb.py
+++ b/mercurial/hgweb.py
@@ -516,8 +516,8 @@
 
         if not args.has_key('cmd') or args['cmd'][0] == 'changelog':
             hi = self.repo.changelog.count()
-            if args.has_key('pos'):
-                hi = int(args['pos'][0])
+            if args.has_key('rev'):
+                hi = int(args['rev'][0])
 
             write(self.changelog(hi))
             
diff --git a/setup.py b/setup.py
index 1f6c61a6058644f4b51e84f81b026cb7a05fc958_c2V0dXAucHk=..083c38bdfa6468113b31a7def64e89b00fbd6551_c2V0dXAucHk= 100644
--- a/setup.py
+++ b/setup.py
@@ -16,4 +16,4 @@
       license='GNU GPL',
       packages=['mercurial'],
       ext_modules=[Extension('mercurial.mpatch', ['mercurial/mpatch.c'])],
-      scripts=['hg', 'hgweb.py'])
+      scripts=['hg'])
diff --git a/templates/changelogentry.tmpl b/templates/changelogentry.tmpl
index 1f6c61a6058644f4b51e84f81b026cb7a05fc958_dGVtcGxhdGVzL2NoYW5nZWxvZ2VudHJ5LnRtcGw=..083c38bdfa6468113b31a7def64e89b00fbd6551_dGVtcGxhdGVzL2NoYW5nZWxvZ2VudHJ5LnRtcGw= 100644
--- a/templates/changelogentry.tmpl
+++ b/templates/changelogentry.tmpl
@@ -1,3 +1,3 @@
-<div class=parity#parity#>
-<table width=100% cellpadding=0 cellspacing=0>
+<div class="parity#parity#">
+<table width="100%" cellpadding="0" cellspacing="0">
 <tr>
@@ -3,4 +3,4 @@
 <tr>
- <td align=right width="15%"><b>#age# ago:&nbsp;</b></td>
+ <td align="right" width="15%"><b>#age# ago:&nbsp;</b></td>
  <td><b>#shortdesc#</b></td</tr>
 <tr>
@@ -5,7 +5,7 @@
  <td><b>#shortdesc#</b></td</tr>
 <tr>
- <td align=right>revision:&nbsp;</td>
+ <td align="right">revision:&nbsp;</td>
  <td><a href="?cmd=changeset;node=#node#">#rev#:#node#</a></td></tr>
 #parent1#
 #parent2#
 <tr>
@@ -8,7 +8,7 @@
  <td><a href="?cmd=changeset;node=#node#">#rev#:#node#</a></td></tr>
 #parent1#
 #parent2#
 <tr>
- <td align=right>manifest:&nbsp;</td>
+ <td align="right">manifest:&nbsp;</td>
  <td><a href="?cmd=manifest;manifest=#manifest#;path=/">#rev#:#manifest#</a></td></tr>
 <tr>
@@ -13,5 +13,5 @@
  <td><a href="?cmd=manifest;manifest=#manifest#;path=/">#rev#:#manifest#</a></td></tr>
 <tr>
- <td align=right>author:&nbsp;</td>
+ <td align="right">author:&nbsp;</td>
  <td>#author#</td></tr>
 <tr>
@@ -16,5 +16,5 @@
  <td>#author#</td></tr>
 <tr>
- <td align=right>date:&nbsp;</td>
+ <td align="right">date:&nbsp;</td>
  <td>#date#</td></tr>
 <tr>
@@ -19,6 +19,6 @@
  <td>#date#</td></tr>
 <tr>
- <td align=right valign=top>files:&nbsp;</td>
+ <td align="right" valign="top">files:&nbsp;</td>
  <td>#files#</td></tr>
 </table>
 </div>
diff --git a/templates/changeset.tmpl b/templates/changeset.tmpl
index 1f6c61a6058644f4b51e84f81b026cb7a05fc958_dGVtcGxhdGVzL2NoYW5nZXNldC50bXBs..083c38bdfa6468113b31a7def64e89b00fbd6551_dGVtcGxhdGVzL2NoYW5nZXNldC50bXBs 100644
--- a/templates/changeset.tmpl
+++ b/templates/changeset.tmpl
@@ -3,8 +3,8 @@
 </head>
 <body>
 
-<div class=buttons>
-<a href="?cmd=changelog&pos=#rev#">changelog</a>
+<div class="buttons">
+<a href="?cmd=changelog;rev=#rev#">changelog</a>
 <a href="?cmd=manifest;manifest=#manifest#;path=/">manifest</a>
 </div>
 
@@ -12,8 +12,8 @@
 
 <table>
 <tr>
- <td class=metatag>revision:</td>
+ <td class="metatag">revision:</td>
  <td><a href="?cmd=changeset;node=#node#">#rev#:#node#</a></td></tr>
 #parent1#
 #parent2#
 <tr>
@@ -16,7 +16,7 @@
  <td><a href="?cmd=changeset;node=#node#">#rev#:#node#</a></td></tr>
 #parent1#
 #parent2#
 <tr>
- <td class=metatag>manifest:</td>
+ <td class="metatag">manifest:</td>
  <td><a href="?cmd=manifest;manifest=#manifest#;path=/">#rev#:#manifest#</a></td></tr>
 <tr>
@@ -21,5 +21,5 @@
  <td><a href="?cmd=manifest;manifest=#manifest#;path=/">#rev#:#manifest#</a></td></tr>
 <tr>
- <td class=metatag>author:</td>
+ <td class="metatag">author:</td>
  <td>#author#</td></tr>
 <tr>
@@ -24,5 +24,5 @@
  <td>#author#</td></tr>
 <tr>
- <td class=metatag>date:</td>
+ <td class="metatag">date:</td>
  <td>#date#</td></tr>
 <tr>
@@ -27,5 +27,5 @@
  <td>#date#</td></tr>
 <tr>
- <td class=metatag valign=top>files:</td>
+ <td class="metatag" valign="top">files:</td>
  <td>#files#</td></tr>
 <tr>
@@ -30,6 +30,6 @@
  <td>#files#</td></tr>
 <tr>
- <td class=metatag valign=top>description:</td>
+ <td class="metatag" valign="top">description:</td>
  <td>#desc#</td></tr>
 </table>
 
@@ -33,7 +33,7 @@
  <td>#desc#</td></tr>
 </table>
 
-<pre class=parity0>
+<pre class="parity0">
 #diff#
 </pre>
 
diff --git a/templates/fileannotate.tmpl b/templates/fileannotate.tmpl
index 1f6c61a6058644f4b51e84f81b026cb7a05fc958_dGVtcGxhdGVzL2ZpbGVhbm5vdGF0ZS50bXBs..083c38bdfa6468113b31a7def64e89b00fbd6551_dGVtcGxhdGVzL2ZpbGVhbm5vdGF0ZS50bXBs 100644
--- a/templates/fileannotate.tmpl
+++ b/templates/fileannotate.tmpl
@@ -3,15 +3,15 @@
 </head>
 <body>
 
-<div class=buttons>
-<a href="?cmd=changelog&rev=#rev#">changelog</a>
-<a href="?cmd=changeset&node=#node#">changeset</a>
-<a href="?cmd=manifest&manifest=#manifest#;path=#path#">manifest</a>
-<a href="?cmd=file&file=#file#&filenode=#filenode#">file</a>
-<a href="?cmd=filelog&file=#file#;filenode=#filenode#">revisions</a>
+<div class="buttons">
+<a href="?cmd=changelog;rev=#rev#">changelog</a>
+<a href="?cmd=changeset;node=#node#">changeset</a>
+<a href="?cmd=manifest;manifest=#manifest#;path=#path#">manifest</a>
+<a href="?cmd=file;file=#file#;filenode=#filenode#">file</a>
+<a href="?cmd=filelog;file=#file#;filenode=#filenode#">revisions</a>
 </div>
 
 <h2>Annotate #file# (#filenode#)</h2>
 
 <table>
 <tr>
@@ -12,11 +12,11 @@
 </div>
 
 <h2>Annotate #file# (#filenode#)</h2>
 
 <table>
 <tr>
- <td class=metatag>changeset:</td>
+ <td class="metatag">changeset:</td>
  <td><a href="?cmd=changeset;node=#node#">#rev#:#node#</a></td></tr>
 #parent1#
 #parent2#
 <tr>
@@ -19,7 +19,7 @@
  <td><a href="?cmd=changeset;node=#node#">#rev#:#node#</a></td></tr>
 #parent1#
 #parent2#
 <tr>
- <td class=metatag>manifest:</td>
+ <td class="metatag">manifest:</td>
  <td><a href="?cmd=manifest;manifest=#manifest#;path=/">#rev#:#manifest#</a></td></tr>
 <tr>
@@ -24,5 +24,5 @@
  <td><a href="?cmd=manifest;manifest=#manifest#;path=/">#rev#:#manifest#</a></td></tr>
 <tr>
- <td class=metatag>author:</td>
+ <td class="metatag">author:</td>
  <td>#author#</td></tr>
 <tr>
@@ -27,8 +27,8 @@
  <td>#author#</td></tr>
 <tr>
- <td class=metatag>date:</td>
+ <td class="metatag">date:</td>
  <td>#date#</td></tr>
 </table>
 
 <br/>
 
@@ -30,9 +30,9 @@
  <td>#date#</td></tr>
 </table>
 
 <br/>
 
-<table cellspacing=0 cellpadding=0>
+<table cellspacing="0" cellpadding="0">
 #annotate#
 </table>
 
diff --git a/templates/filediff.tmpl b/templates/filediff.tmpl
index 1f6c61a6058644f4b51e84f81b026cb7a05fc958_dGVtcGxhdGVzL2ZpbGVkaWZmLnRtcGw=..083c38bdfa6468113b31a7def64e89b00fbd6551_dGVtcGxhdGVzL2ZpbGVkaWZmLnRtcGw= 100644
--- a/templates/filediff.tmpl
+++ b/templates/filediff.tmpl
@@ -3,15 +3,15 @@
 </head>
 <body>
 
-<div class=buttons>
-<a href="?cmd=changelog&rev=#rev#">changelog</a>
-<a href="?cmd=changeset&node=#node#">changeset</a>
-<a href="?cmd=file&file=#file#&filenode=#filenode#">file</a>
-<a href="?cmd=filelog&file=#file#&filenode=#filenode#">revisions</a>
-<a href="?cmd=annotate&file=#file#&filenode=#filenode#">annotate</a>
+<div class="buttons">
+<a href="?cmd=changelog;rev=#rev#">changelog</a>
+<a href="?cmd=changeset;node=#node#">changeset</a>
+<a href="?cmd=file;file=#file#;filenode=#filenode#">file</a>
+<a href="?cmd=filelog;file=#file#;filenode=#filenode#">revisions</a>
+<a href="?cmd=annotate;file=#file#;filenode=#filenode#">annotate</a>
 </div>
 
 <h2>#file#</h2>
 
 <table>
 <tr>
@@ -12,9 +12,9 @@
 </div>
 
 <h2>#file#</h2>
 
 <table>
 <tr>
- <td class=metatag>revision:</td>
+ <td class="metatag">revision:</td>
  <td><a href="?cmd=changeset;node=#node#">#rev#:#node#</a></td></tr>
 <tr>
@@ -19,6 +19,6 @@
  <td><a href="?cmd=changeset;node=#node#">#rev#:#node#</a></td></tr>
 <tr>
- <td class=metatag>parent:</td>
+ <td class="metatag">parent:</td>
  <td><a href="?cmd=changeset;node=#p1#">#p1rev#:#p1#</a></td></tr>
 </table>
 
@@ -22,7 +22,7 @@
  <td><a href="?cmd=changeset;node=#p1#">#p1rev#:#p1#</a></td></tr>
 </table>
 
-<pre class=parity0>
+<pre class="parity0">
 #diff#
 </pre>
 
diff --git a/templates/filelog.tmpl b/templates/filelog.tmpl
index 1f6c61a6058644f4b51e84f81b026cb7a05fc958_dGVtcGxhdGVzL2ZpbGVsb2cudG1wbA==..083c38bdfa6468113b31a7def64e89b00fbd6551_dGVtcGxhdGVzL2ZpbGVsb2cudG1wbA== 100644
--- a/templates/filelog.tmpl
+++ b/templates/filelog.tmpl
@@ -3,5 +3,5 @@
 </head>
 <body>
 
-<div class=buttons>
+<div class="buttons">
 <a href="?cmd=changelog">changelog</a>
@@ -7,6 +7,6 @@
 <a href="?cmd=changelog">changelog</a>
-<a href="?cmd=file&file=#file#&filenode=#filenode#">file</a>
-<a href="?cmd=annotate&file=#file#&filenode=#filenode#">annotate</a>
+<a href="?cmd=file;file=#file#;filenode=#filenode#">file</a>
+<a href="?cmd=annotate;file=#file#;filenode=#filenode#">annotate</a>
 </div>
 
 <h2>#file# revision history</h2>
diff --git a/templates/filelogentry.tmpl b/templates/filelogentry.tmpl
index 1f6c61a6058644f4b51e84f81b026cb7a05fc958_dGVtcGxhdGVzL2ZpbGVsb2dlbnRyeS50bXBs..083c38bdfa6468113b31a7def64e89b00fbd6551_dGVtcGxhdGVzL2ZpbGVsb2dlbnRyeS50bXBs 100644
--- a/templates/filelogentry.tmpl
+++ b/templates/filelogentry.tmpl
@@ -1,2 +1,2 @@
-<table class=parity#parity# width=100% cellspacing=0 cellpadding=0>
+<table class="parity#parity#" width="100%" cellspacing="0" cellpadding="0">
 <tr>
@@ -2,4 +2,4 @@
 <tr>
- <td align=right width="15%"><b>#age# ago:&nbsp;</b></td>
+ <td align="right" width="15%"><b>#age# ago:&nbsp;</b></td>
  <td><b><a href="?cmd=changeset;node=#node#">#shortdesc#</a></b></td</tr>
 <tr>
@@ -4,8 +4,8 @@
  <td><b><a href="?cmd=changeset;node=#node#">#shortdesc#</a></b></td</tr>
 <tr>
- <td align=right>revision:&nbsp;</td>
+ <td align="right">revision:&nbsp;</td>
  <td><a href="?cmd=file;file=#file#;filenode=#filenode#">#filerev#:#filenode#</a>
 <a href="?cmd=filediff;file=#file#;node=#node#">(diff)</a>
 <a href="?cmd=annotate;file=#file#;filenode=#filenode#">(annotate)</a>
 </td></tr>
 <tr>
@@ -7,8 +7,8 @@
  <td><a href="?cmd=file;file=#file#;filenode=#filenode#">#filerev#:#filenode#</a>
 <a href="?cmd=filediff;file=#file#;node=#node#">(diff)</a>
 <a href="?cmd=annotate;file=#file#;filenode=#filenode#">(annotate)</a>
 </td></tr>
 <tr>
- <td align=right>author:&nbsp;</td>
+ <td align="right">author:&nbsp;</td>
  <td>#author#</td></tr>
 <tr>
@@ -13,6 +13,6 @@
  <td>#author#</td></tr>
 <tr>
- <td align=right>date:&nbsp;</td>
+ <td align="right">date:&nbsp;</td>
  <td>#date#</td></tr>
 </table>
 
diff --git a/templates/filerevision.tmpl b/templates/filerevision.tmpl
index 1f6c61a6058644f4b51e84f81b026cb7a05fc958_dGVtcGxhdGVzL2ZpbGVyZXZpc2lvbi50bXBs..083c38bdfa6468113b31a7def64e89b00fbd6551_dGVtcGxhdGVzL2ZpbGVyZXZpc2lvbi50bXBs 100644
--- a/templates/filerevision.tmpl
+++ b/templates/filerevision.tmpl
@@ -3,15 +3,15 @@
 </head>
 <body>
 
-<div class=buttons>
-<a href="?cmd=changelog&rev=#rev#">changelog</a>
-<a href="?cmd=changeset&node=#node#">changeset</a>
-<a href="?cmd=manifest&manifest=#manifest#;path=#path#">manifest</a>
-<a href="?cmd=filelog&file=#file#;filenode=#filenode#">revisions</a>
-<a href="?cmd=annotate&file=#file#&filenode=#filenode#">annotate</a>
+<div class="buttons">
+<a href="?cmd=changelog;rev=#rev#">changelog</a>
+<a href="?cmd=changeset;node=#node#">changeset</a>
+<a href="?cmd=manifest;manifest=#manifest#;path=#path#">manifest</a>
+<a href="?cmd=filelog;file=#file#;filenode=#filenode#">revisions</a>
+<a href="?cmd=annotate;file=#file#;filenode=#filenode#">annotate</a>
 </div>
 
 <h2>#file# (revision #filenode#)</h2>
 
 <table>
 <tr>
@@ -12,11 +12,11 @@
 </div>
 
 <h2>#file# (revision #filenode#)</h2>
 
 <table>
 <tr>
- <td class=metatag>changeset:</td>
+ <td class="metatag">changeset:</td>
  <td><a href="?cmd=changeset;node=#node#">#rev#:#node#</a></td></tr>
 #parent1#
 #parent2#
 <tr>
@@ -19,7 +19,7 @@
  <td><a href="?cmd=changeset;node=#node#">#rev#:#node#</a></td></tr>
 #parent1#
 #parent2#
 <tr>
- <td class=metatag>manifest:</td>
+ <td class="metatag">manifest:</td>
  <td><a href="?cmd=manifest;manifest=#manifest#;path=/">#rev#:#manifest#</a></td></tr>
 <tr>
@@ -24,5 +24,5 @@
  <td><a href="?cmd=manifest;manifest=#manifest#;path=/">#rev#:#manifest#</a></td></tr>
 <tr>
- <td class=metatag>author:</td>
+ <td class="metatag">author:</td>
  <td>#author#</td></tr>
 <tr>
@@ -27,6 +27,6 @@
  <td>#author#</td></tr>
 <tr>
- <td class=metatag>date:</td>
+ <td class="metatag">date:</td>
  <td>#date#</td></tr>
 </table>
 
diff --git a/templates/header.tmpl b/templates/header.tmpl
index 1f6c61a6058644f4b51e84f81b026cb7a05fc958_dGVtcGxhdGVzL2hlYWRlci50bXBs..083c38bdfa6468113b31a7def64e89b00fbd6551_dGVtcGxhdGVzL2hlYWRlci50bXBs 100644
--- a/templates/header.tmpl
+++ b/templates/header.tmpl
@@ -1,4 +1,5 @@
 Content-type: text/html
 
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
 <html>
 <head>
@@ -3,6 +4,5 @@
 <html>
 <head>
-</head>
 <style type="text/css">
 a { text-decoration:none; }
 .parity0 { background-color: #eeeeee; }
@@ -26,6 +26,3 @@
 }
 
 </style>
-</head>
-<body>
-
diff --git a/templates/manifest.tmpl b/templates/manifest.tmpl
index 1f6c61a6058644f4b51e84f81b026cb7a05fc958_dGVtcGxhdGVzL21hbmlmZXN0LnRtcGw=..083c38bdfa6468113b31a7def64e89b00fbd6551_dGVtcGxhdGVzL21hbmlmZXN0LnRtcGw= 100644
--- a/templates/manifest.tmpl
+++ b/templates/manifest.tmpl
@@ -3,10 +3,10 @@
 </head>
 <body>
 
-<div class=buttons>
-<a href="?cmd=changelog&rev=#rev#">changelog</a>
-<a href="?cmd=changeset&node=#node#">changeset</a>
+<div class="buttons">
+<a href="?cmd=changelog;rev=#rev#">changelog</a>
+<a href="?cmd=changeset;node=#node#">changeset</a>
 </div>
 
 <h2>manifest: #path#</h2>
 
@@ -9,7 +9,7 @@
 </div>
 
 <h2>manifest: #path#</h2>
 
-<div class=parity1><a href="?cmd=manifest;manifest=#manifest#;path=#up#">[up]</a><br /></div>
+<div class="parity1"><a href="?cmd=manifest;manifest=#manifest#;path=#up#">[up]</a><br /></div>
 #entries#
 
@@ -14,3 +14,3 @@
 #entries#
 
-#footer#
\ No newline at end of file
+#footer#
diff --git a/templates/map b/templates/map
index 1f6c61a6058644f4b51e84f81b026cb7a05fc958_dGVtcGxhdGVzL21hcA==..083c38bdfa6468113b31a7def64e89b00fbd6551_dGVtcGxhdGVzL21hcA== 100644
--- a/templates/map
+++ b/templates/map
@@ -8,9 +8,9 @@
 changelogentry = changelogentry.tmpl
 changeset = changeset.tmpl
 manifest = manifest.tmpl
-manifestdirentry = "<div class=parity#parity#><a href="?cmd=manifest;manifest=#manifest#;path=#path#">#basename#/</a><br /></div>"
-manifestfileentry = "<div class=parity#parity#><a href="?cmd=file;filenode=#filenode#;file=#file#">#basename#</a><br /></div>"
+manifestdirentry = "<div class="parity#parity#"><a href="?cmd=manifest;manifest=#manifest#;path=#path#">#basename#/</a><br /></div>"
+manifestfileentry = "<div class="parity#parity#"><a href="?cmd=file;filenode=#filenode#;file=#file#">#basename#</a><br /></div>"
 filerevision = filerevision.tmpl
 fileannotate = fileannotate.tmpl
 filediff = filediff.tmpl
 filelog = filelog.tmpl
@@ -13,6 +13,6 @@
 filerevision = filerevision.tmpl
 fileannotate = fileannotate.tmpl
 filediff = filediff.tmpl
 filelog = filelog.tmpl
-fileline = "<div class=parity#parity#><span class=lineno>#linenumber# </span>#line#</div>"
+fileline = "<div class="parity#parity#"><span class="lineno">#linenumber# </span>#line#</div>"
 filelogentry = filelogentry.tmpl
@@ -18,6 +18,6 @@
 filelogentry = filelogentry.tmpl
-annotateline = "<tr class=parity#parity#><td class=annotate><a href="?cmd=changeset;node=#node#">#author#@#rev#</a></td><td><pre>#line#</pre></td></tr>"
-difflineplus = "<span class=plusline>#line#</span>"
-difflineminus = "<span class=minusline>#line#</span>"
-difflineat = "<span class=atline>#line#</span>"
+annotateline = "<tr class="parity#parity#"><td class="annotate"><a href="?cmd=changeset;node=#node#">#author#@#rev#</a></td><td><pre>#line#</pre></td></tr>"
+difflineplus = "<span class="plusline">#line#</span>"
+difflineminus = "<span class="minusline">#line#</span>"
+difflineat = "<span class="atline">#line#</span>"
 diffline = "#line#"
@@ -23,5 +23,5 @@
 diffline = "#line#"
-changelogparent = "<tr><td align=right>parent:&nbsp;</td><td><a href="?cmd=changeset;node=#node#">#rev#:#node#</a></td></tr>"
-changesetparent = "<tr><td class=metatag>parent:</td><td><a href="?cmd=changeset;node=#node#">#rev#:#node#</a></td></tr>"
-filerevparent = "<tr><td class=metatag>parent:</td><td><a href="?cmd=changeset;node=#node#">#rev#:#node#</a></td></tr>"
-fileannotateparent = "<tr><td class=metatag>parent:</td><td><a href="?cmd=changeset;node=#node#">#rev#:#node#</a></td></tr>"
+changelogparent = "<tr><td align="right">parent:&nbsp;</td><td><a href="?cmd=changeset;node=#node#">#rev#:#node#</a></td></tr>"
+changesetparent = "<tr><td class="metatag">parent:</td><td><a href="?cmd=changeset;node=#node#">#rev#:#node#</a></td></tr>"
+filerevparent = "<tr><td class="metatag">parent:</td><td><a href="?cmd=changeset;node=#node#">#rev#:#node#</a></td></tr>"
+fileannotateparent = "<tr><td class="metatag">parent:</td><td><a href="?cmd=changeset;node=#node#">#rev#:#node#</a></td></tr>"