Patchwork [4,of,5] monoblue: don't show '[up]' in file view when in root directory already

login
register
mail settings
Submitter Anton Shestakov
Date May 31, 2018, 1:11 p.m.
Message ID <376f6749677c4490644f.1527772299@neuro>
Download mbox | patch
Permalink /patch/31919/
State Accepted
Headers show

Comments

Anton Shestakov - May 31, 2018, 1:11 p.m.
# HG changeset patch
# User Anton Shestakov <av6@dwimlabs.net>
# Date 1527763175 -28800
#      Thu May 31 18:39:35 2018 +0800
# Node ID 376f6749677c4490644fef7590df666f66f0a47d
# Parent  d588869f4819d644a448456535f5f860be3d0aca
monoblue: don't show '[up]' in file view when in root directory already

Patch

diff --git a/mercurial/templates/monoblue/manifest.tmpl b/mercurial/templates/monoblue/manifest.tmpl
--- a/mercurial/templates/monoblue/manifest.tmpl
+++ b/mercurial/templates/monoblue/manifest.tmpl
@@ -33,13 +33,7 @@ 
     <p class="files">{path|escape} {alltags}</p>
 
     <table>
-        <tr class="parity{upparity}">
-            <td>drwxr-xr-x</td>
-            <td></td>
-            <td></td>
-            <td><a href="{url|urlescape}file/{symrev}{up|urlescape}{sessionvars%urlparameter}">[up]</a></td>
-            <td class="link">&nbsp;</td>
-        </tr>
+        {ifeq(path, up, '', updirentry)}
         {dentries%direntry}
         {fentries%fileentry}
     </table>
diff --git a/mercurial/templates/monoblue/map b/mercurial/templates/monoblue/map
--- a/mercurial/templates/monoblue/map
+++ b/mercurial/templates/monoblue/map
@@ -59,6 +59,16 @@  fileellipses = '...'
 changelogentry = changelogentry.tmpl
 changeset = changeset.tmpl
 manifest = manifest.tmpl
+updirentry = '
+  <tr class="parity{upparity}">
+    <td>drwxr-xr-x</td>
+    <td></td>
+    <td></td>
+    <td>
+      <a href="{url|urlescape}file/{symrev}{up|urlescape}{sessionvars%urlparameter}">[up]</a>
+    </td>
+    <td class="link">&nbsp;</td>
+  </tr>'
 direntry = '
   <tr class="parity{parity}">
     <td>drwxr-xr-x</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
@@ -312,13 +312,7 @@  manifest with descending (monoblue)
       <p class="files">/ <span class="logtags"><span class="phasetag" title="draft">draft</span> <span class="branchtag" title="default">default</span> <span class="tagtag" title="tip">tip</span> </span></p>
   
       <table>
-          <tr class="parity0">
-              <td>drwxr-xr-x</td>
-              <td></td>
-              <td></td>
-              <td><a href="/file/tip/?style=monoblue">[up]</a></td>
-              <td class="link">&nbsp;</td>
-          </tr>
+          
           
   <tr class="parity1">
   <td>drwxr-xr-x</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
@@ -754,7 +754,6 @@  Set up the repo
               <li><a href="/graph/tip?style=monoblue">graph</a></li>
           <li><a href="/rev/tip?style=monoblue">changeset</a></li>
           <li><a href="/archive/tip.zip">zip</a></li>
-              <td><a href="/file/tip/?style=monoblue">[up]</a></td>
   <a href="/file/tip/dir?style=monoblue">dir</a>
   <a href="/file/tip/dir/?style=monoblue"></a>
   <td><a href="/file/tip/dir?style=monoblue">files</a></td>
@@ -817,7 +816,6 @@  Set up the repo
               <li><a href="/graph/xyzzy?style=monoblue">graph</a></li>
           <li><a href="/rev/xyzzy?style=monoblue">changeset</a></li>
           <li><a href="/archive/xyzzy.zip">zip</a></li>
-              <td><a href="/file/xyzzy/?style=monoblue">[up]</a></td>
   <a href="/file/xyzzy/dir?style=monoblue">dir</a>
   <a href="/file/xyzzy/dir/?style=monoblue"></a>
   <td><a href="/file/xyzzy/dir?style=monoblue">files</a></td>
diff --git a/tests/test-hgweb.t b/tests/test-hgweb.t
--- a/tests/test-hgweb.t
+++ b/tests/test-hgweb.t
@@ -812,6 +812,10 @@  no '[up]' entry in file view when in roo
   [1]
   $ get-with-headers.py localhost:$HGPORT 'file/tip/da?style=gitweb' | grep -F '[up]'
   <a href="/file/tip/?style=gitweb">[up]</a>
+  $ get-with-headers.py localhost:$HGPORT 'file/tip?style=monoblue' | grep -F '[up]'
+  [1]
+  $ get-with-headers.py localhost:$HGPORT 'file/tip/da?style=monoblue' | grep -F '[up]'
+  <a href="/file/tip/?style=monoblue">[up]</a>
 
 no style can be loaded from directories other than the specified paths