paper: don't show '[up]' in file view when in root directory already
authorAnton Shestakov <av6@dwimlabs.net>
Thu, 31 May 2018 18:01:54 +0800
changeset 38215 c2e3bc99fba4
parent 38214 45765264ae3a
child 38216 d6aa1fc8292f
paper: don't show '[up]' in file view when in root directory already
mercurial/templates/paper/manifest.tmpl
mercurial/templates/paper/map
tests/test-hgweb-descend-empties.t
tests/test-hgweb-empty.t
tests/test-hgweb-symrev.t
tests/test-hgweb.t
--- a/mercurial/templates/paper/manifest.tmpl	Thu May 31 16:52:02 2018 +0800
+++ b/mercurial/templates/paper/manifest.tmpl	Thu May 31 18:01:54 2018 +0800
@@ -46,11 +46,7 @@
 </tr>
 </thead>
 <tbody class="stripes2">
-<tr class="fileline">
-  <td class="name"><a href="{url|urlescape}file/{symrev}{up|urlescape}{sessionvars%urlparameter}">[up]</a></td>
-  <td class="size"></td>
-  <td class="permissions">drwxr-xr-x</td>
-</tr>
+{ifeq(path, up, '', updirentry)}
 {dentries%direntry}
 {fentries%fileentry}
 </tbody>
--- a/mercurial/templates/paper/map	Thu May 31 16:52:02 2018 +0800
+++ b/mercurial/templates/paper/map	Thu May 31 18:01:54 2018 +0800
@@ -41,6 +41,15 @@
 navgraph = '{before%navgraphentry}{after%navgraphentry}'
 filenav = '{before%filenaventry}{after%filenaventry}'
 
+updirentry = '
+  <tr class="fileline">
+    <td class="name">
+      <a href="{url|urlescape}file/{symrev}{up|urlescape}{sessionvars%urlparameter}">[up]</a>
+    </td>
+    <td class="size"></td>
+    <td class="permissions">drwxr-xr-x</td>
+  </tr>'
+
 direntry = '
   <tr class="fileline">
     <td class="name">
--- a/tests/test-hgweb-descend-empties.t	Thu May 31 16:52:02 2018 +0800
+++ b/tests/test-hgweb-descend-empties.t	Thu May 31 18:01:54 2018 +0800
@@ -93,11 +93,7 @@
   </tr>
   </thead>
   <tbody class="stripes2">
-  <tr class="fileline">
-    <td class="name"><a href="/file/tip/">[up]</a></td>
-    <td class="size"></td>
-    <td class="permissions">drwxr-xr-x</td>
-  </tr>
+  
   
   <tr class="fileline">
   <td class="name">
@@ -213,11 +209,7 @@
   </tr>
   </thead>
   <tbody class="stripes2">
-  <tr class="fileline">
-    <td class="name"><a href="/file/tip/?style=coal">[up]</a></td>
-    <td class="size"></td>
-    <td class="permissions">drwxr-xr-x</td>
-  </tr>
+  
   
   <tr class="fileline">
   <td class="name">
--- a/tests/test-hgweb-empty.t	Thu May 31 16:52:02 2018 +0800
+++ b/tests/test-hgweb-empty.t	Thu May 31 18:01:54 2018 +0800
@@ -396,11 +396,7 @@
   </tr>
   </thead>
   <tbody class="stripes2">
-  <tr class="fileline">
-    <td class="name"><a href="/file/tip/">[up]</a></td>
-    <td class="size"></td>
-    <td class="permissions">drwxr-xr-x</td>
-  </tr>
+  
   
   
   </tbody>
--- a/tests/test-hgweb-symrev.t	Thu May 31 16:52:02 2018 +0800
+++ b/tests/test-hgweb-symrev.t	Thu May 31 18:01:54 2018 +0800
@@ -72,7 +72,6 @@
   <li><a href="/rev/tip?style=paper">changeset</a></li>
   <a href="/archive/tip.zip">zip</a>
    directory / @ 2:<a href="/rev/9d8c40cba617?style=paper">9d8c40cba617</a>
-    <td class="name"><a href="/file/tip/?style=paper">[up]</a></td>
   <a href="/file/tip/dir?style=paper">
   <a href="/file/tip/dir/?style=paper">
   <a href="/file/tip/foo?style=paper">
@@ -138,7 +137,6 @@
   <li><a href="/rev/xyzzy?style=paper">changeset</a></li>
   <a href="/archive/xyzzy.zip">zip</a>
    directory / @ 1:<a href="/rev/a7c1559b7bba?style=paper">a7c1559b7bba</a>
-    <td class="name"><a href="/file/xyzzy/?style=paper">[up]</a></td>
   <a href="/file/xyzzy/dir?style=paper">
   <a href="/file/xyzzy/dir/?style=paper">
   <a href="/file/xyzzy/foo?style=paper">
@@ -272,7 +270,6 @@
   <li><a href="/rev/tip?style=coal">changeset</a></li>
   <a href="/archive/tip.zip">zip</a>
    directory / @ 2:<a href="/rev/9d8c40cba617?style=coal">9d8c40cba617</a>
-    <td class="name"><a href="/file/tip/?style=coal">[up]</a></td>
   <a href="/file/tip/dir?style=coal">
   <a href="/file/tip/dir/?style=coal">
   <a href="/file/tip/foo?style=coal">
@@ -338,7 +335,6 @@
   <li><a href="/rev/xyzzy?style=coal">changeset</a></li>
   <a href="/archive/xyzzy.zip">zip</a>
    directory / @ 1:<a href="/rev/a7c1559b7bba?style=coal">a7c1559b7bba</a>
-    <td class="name"><a href="/file/xyzzy/?style=coal">[up]</a></td>
   <a href="/file/xyzzy/dir?style=coal">
   <a href="/file/xyzzy/dir/?style=coal">
   <a href="/file/xyzzy/foo?style=coal">
--- a/tests/test-hgweb.t	Thu May 31 16:52:02 2018 +0800
+++ b/tests/test-hgweb.t	Thu May 31 18:01:54 2018 +0800
@@ -287,11 +287,7 @@
   </tr>
   </thead>
   <tbody class="stripes2">
-  <tr class="fileline">
-    <td class="name"><a href="/file/tip/">[up]</a></td>
-    <td class="size"></td>
-    <td class="permissions">drwxr-xr-x</td>
-  </tr>
+  
   
   <tr class="fileline">
   <td class="name">
@@ -802,6 +798,17 @@
   200 Script output follows
    changeset 0:<a href="/rev/2ef0ac749a14?style=paper">2ef0ac749a14</a>
 
+no '[up]' entry in file view when in root directory
+
+  $ get-with-headers.py localhost:$HGPORT 'file/tip?style=paper' | grep -F '[up]'
+  [1]
+  $ get-with-headers.py localhost:$HGPORT 'file/tip/da?style=paper' | grep -F '[up]'
+  <a href="/file/tip/?style=paper">[up]</a>
+  $ get-with-headers.py localhost:$HGPORT 'file/tip?style=coal' | grep -F '[up]'
+  [1]
+  $ get-with-headers.py localhost:$HGPORT 'file/tip/da?style=coal' | grep -F '[up]'
+  <a href="/file/tip/?style=coal">[up]</a>
+
 no style can be loaded from directories other than the specified paths
 
   $ mkdir -p x/templates/fallback