spartan: don't show '[up]' in file view when in root directory already
authorAnton Shestakov <av6@dwimlabs.net>
Thu, 31 May 2018 18:53:28 +0800
changeset 38218 273ce823ba5c
parent 38217 9ed3527019b5
child 38219 db9d1dd01bf0
spartan: don't show '[up]' in file view when in root directory already
mercurial/templates/spartan/manifest.tmpl
mercurial/templates/spartan/map
tests/test-hgweb-descend-empties.t
tests/test-hgweb-symrev.t
tests/test-hgweb.t
--- a/mercurial/templates/spartan/manifest.tmpl	Thu May 31 18:39:35 2018 +0800
+++ b/mercurial/templates/spartan/manifest.tmpl	Thu May 31 18:53:28 2018 +0800
@@ -17,12 +17,7 @@
 <h2><a href="/">Mercurial</a> {pathdef%breadcrumb} / files for changeset <a href="{url|urlescape}rev/{node|short}">{node|short}</a>: {path|escape}</h2>
 
 <table cellpadding="0" cellspacing="0">
-<tr class="parity{upparity}">
-  <td><tt>drwxr-xr-x</tt>&nbsp;
-  <td>&nbsp;
-  <td>&nbsp;
-  <td><a href="{url|urlescape}file/{symrev}{up|urlescape}{sessionvars%urlparameter}">[up]</a>
-</tr>
+{ifeq(path, up, '', updirentry)}
 {dentries%direntry}
 {fentries%fileentry}
 </table>
--- a/mercurial/templates/spartan/map	Thu May 31 18:39:35 2018 +0800
+++ b/mercurial/templates/spartan/map	Thu May 31 18:53:28 2018 +0800
@@ -25,6 +25,16 @@
 navgraph = '{before%navgraphentry}{after%navgraphentry}'
 filenav = '{before%filenaventry}{after%filenaventry}'
 
+updirentry = '
+  <tr class="parity{upparity}">
+    <td><tt>drwxr-xr-x</tt>&nbsp;</td>
+    <td>&nbsp;</td>
+    <td>&nbsp;</td>
+    <td>
+      <a href="{url|urlescape}file/{symrev}{up|urlescape}{sessionvars%urlparameter}">[up]</a>
+    </td>
+  </tr> '
+
 direntry = '
   <tr class="parity{parity}">
     <td><tt>drwxr-xr-x</tt>&nbsp;</td>
--- a/tests/test-hgweb-descend-empties.t	Thu May 31 18:39:35 2018 +0800
+++ b/tests/test-hgweb-descend-empties.t	Thu May 31 18:53:28 2018 +0800
@@ -504,12 +504,7 @@
   <h2><a href="/">Mercurial</a>  / files for changeset <a href="/rev/c9f45f7a1659">c9f45f7a1659</a>: /</h2>
   
   <table cellpadding="0" cellspacing="0">
-  <tr class="parity0">
-    <td><tt>drwxr-xr-x</tt>&nbsp;
-    <td>&nbsp;
-    <td>&nbsp;
-    <td><a href="/file/tip/?style=spartan">[up]</a>
-  </tr>
+  
   
   <tr class="parity1">
   <td><tt>drwxr-xr-x</tt>&nbsp;</td>
--- a/tests/test-hgweb-symrev.t	Thu May 31 18:39:35 2018 +0800
+++ b/tests/test-hgweb-symrev.t	Thu May 31 18:53:28 2018 +0800
@@ -956,7 +956,6 @@
   <a href="/rev/tip?style=spartan">changeset</a>
   <a href="/archive/tip.zip">zip</a> 
   <h2><a href="/">Mercurial</a>  / files for changeset <a href="/rev/9d8c40cba617">9d8c40cba617</a>: /</h2>
-    <td><a href="/file/tip/?style=spartan">[up]</a>
   <a href="/file/tip/dir?style=spartan">dir/</a>
   <a href="/file/tip/dir/?style=spartan">
   <td><a href="/file/tip/foo?style=spartan">foo</a></td>
@@ -1029,7 +1028,6 @@
   <a href="/rev/xyzzy?style=spartan">changeset</a>
   <a href="/archive/xyzzy.zip">zip</a> 
   <h2><a href="/">Mercurial</a>  / files for changeset <a href="/rev/a7c1559b7bba">a7c1559b7bba</a>: /</h2>
-    <td><a href="/file/xyzzy/?style=spartan">[up]</a>
   <a href="/file/xyzzy/dir?style=spartan">dir/</a>
   <a href="/file/xyzzy/dir/?style=spartan">
   <td><a href="/file/xyzzy/foo?style=spartan">foo</a></td>
--- a/tests/test-hgweb.t	Thu May 31 18:39:35 2018 +0800
+++ b/tests/test-hgweb.t	Thu May 31 18:53:28 2018 +0800
@@ -816,6 +816,10 @@
   [1]
   $ get-with-headers.py localhost:$HGPORT 'file/tip/da?style=monoblue' | grep -F '[up]'
   <a href="/file/tip/?style=monoblue">[up]</a>
+  $ get-with-headers.py localhost:$HGPORT 'file/tip?style=spartan' | grep -F '[up]'
+  [1]
+  $ get-with-headers.py localhost:$HGPORT 'file/tip/da?style=spartan' | grep -F '[up]'
+  <a href="/file/tip/?style=spartan">[up]</a>
 
 no style can be loaded from directories other than the specified paths