[PATCH 5 of 5] spartan: don't show '[up]' in file view when in root directory already

Anton Shestakov av6 at dwimlabs.net
Thu May 31 09:11:40 EDT 2018


# HG changeset patch
# User Anton Shestakov <av6 at dwimlabs.net>
# Date 1527764008 -28800
#      Thu May 31 18:53:28 2018 +0800
# Node ID a9591fc50eb394454125df2807c1fcd8f3cd8193
# Parent  376f6749677c4490644fef7590df666f66f0a47d
spartan: don't show '[up]' in file view when in root directory already

diff --git a/mercurial/templates/spartan/manifest.tmpl b/mercurial/templates/spartan/manifest.tmpl
--- a/mercurial/templates/spartan/manifest.tmpl
+++ b/mercurial/templates/spartan/manifest.tmpl
@@ -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> 
-  <td> 
-  <td> 
-  <td><a href="{url|urlescape}file/{symrev}{up|urlescape}{sessionvars%urlparameter}">[up]</a>
-</tr>
+{ifeq(path, up, '', updirentry)}
 {dentries%direntry}
 {fentries%fileentry}
 </table>
diff --git a/mercurial/templates/spartan/map b/mercurial/templates/spartan/map
--- a/mercurial/templates/spartan/map
+++ b/mercurial/templates/spartan/map
@@ -25,6 +25,16 @@ navshort = '{before%navshortentry}{after
 navgraph = '{before%navgraphentry}{after%navgraphentry}'
 filenav = '{before%filenaventry}{after%filenaventry}'
 
+updirentry = '
+  <tr class="parity{upparity}">
+    <td><tt>drwxr-xr-x</tt> </td>
+    <td> </td>
+    <td> </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> </td>
diff --git a/tests/test-hgweb-descend-empties.t b/tests/test-hgweb-descend-empties.t
--- a/tests/test-hgweb-descend-empties.t
+++ b/tests/test-hgweb-descend-empties.t
@@ -504,12 +504,7 @@ manifest with descending (spartan)
   <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> 
-    <td> 
-    <td> 
-    <td><a href="/file/tip/?style=spartan">[up]</a>
-  </tr>
+  
   
   <tr class="parity1">
   <td><tt>drwxr-xr-x</tt> </td>
diff --git a/tests/test-hgweb-symrev.t b/tests/test-hgweb-symrev.t
--- a/tests/test-hgweb-symrev.t
+++ b/tests/test-hgweb-symrev.t
@@ -956,7 +956,6 @@ Set up the repo
   <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 @@ Set up the repo
   <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>
diff --git a/tests/test-hgweb.t b/tests/test-hgweb.t
--- a/tests/test-hgweb.t
+++ b/tests/test-hgweb.t
@@ -816,6 +816,10 @@ no '[up]' entry in file view when in roo
   [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
 


More information about the Mercurial-devel mailing list