changeset 37403:448f7ec247e2

hgweb: fix type of {nav} keyword when linerange filter is active Spotted by making '%' operator check the operand type more strictly. Before, "{nav}" would be evaluated to a lazy "" (empty string) and {"" % x} would yield one empty string.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 18 Mar 2018 21:18:57 +0900
parents 546dc42c3bc4
children 7c902a8345ef
files mercurial/hgweb/webcommands.py tests/test-hgweb-filelog.t
diffstat 2 files changed, 9 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py	Sun Mar 18 21:46:20 2018 +0900
+++ b/mercurial/hgweb/webcommands.py	Sun Mar 18 21:18:57 2018 +0900
@@ -1082,7 +1082,7 @@
         linerange = webutil.formatlinerange(*lrange)
         # deactivate numeric nav links when linerange is specified as this
         # would required a dedicated "revnav" class
-        nav = None
+        nav = []
         if descend:
             it = dagop.blockdescendants(fctx, *lrange)
         else:
--- a/tests/test-hgweb-filelog.t	Sun Mar 18 21:46:20 2018 +0900
+++ b/tests/test-hgweb-filelog.t	Sun Mar 18 21:18:57 2018 +0900
@@ -755,7 +755,7 @@
   <div class="navigate">
   <a href="/log/tip/c?linerange=1%3A2&revcount=30">less</a>
   <a href="/log/tip/c?linerange=1%3A2&revcount=120">more</a>
-  |  </div>
+  | </div>
   
   <table class="bigtable">
   <thead>
@@ -791,7 +791,7 @@
   <div class="navigate">
   <a href="/log/tip/c?linerange=1%3A2&revcount=30">less</a>
   <a href="/log/tip/c?linerange=1%3A2&revcount=120">more</a>
-  |  
+  | 
   </div>
   
   </div>
@@ -875,7 +875,7 @@
   <div class="navigate">
   <a href="/log/tip/c?linerange=1%3A2&revcount=1">less</a>
   <a href="/log/tip/c?linerange=1%3A2&revcount=2">more</a>
-  |  </div>
+  | </div>
   
   <table class="bigtable">
   <thead>
@@ -902,7 +902,7 @@
   <div class="navigate">
   <a href="/log/tip/c?linerange=1%3A2&revcount=1">less</a>
   <a href="/log/tip/c?linerange=1%3A2&revcount=2">more</a>
-  |  
+  | 
   </div>
   
   </div>
@@ -1394,7 +1394,7 @@
   <div class="navigate">
   <a href="/log/tip/c?linerange=3%3A4&patch=&revcount=30">less</a>
   <a href="/log/tip/c?linerange=3%3A4&patch=&revcount=120">more</a>
-  |  </div>
+  | </div>
   
   <table class="bigtable">
   <thead>
@@ -1500,7 +1500,7 @@
   <div class="navigate">
   <a href="/log/tip/c?linerange=3%3A4&patch=&revcount=30">less</a>
   <a href="/log/tip/c?linerange=3%3A4&patch=&revcount=120">more</a>
-  |  
+  | 
   </div>
   
   </div>
@@ -1651,7 +1651,7 @@
   <div class="navigate">
   <a href="/log/8/c?descend=&linerange=3%3A4&revcount=30">less</a>
   <a href="/log/8/c?descend=&linerange=3%3A4&revcount=120">more</a>
-  |  </div>
+  | </div>
   
   <table class="bigtable">
   <thead>
@@ -1696,7 +1696,7 @@
   <div class="navigate">
   <a href="/log/8/c?descend=&linerange=3%3A4&revcount=30">less</a>
   <a href="/log/8/c?descend=&linerange=3%3A4&revcount=120">more</a>
-  |  
+  | 
   </div>
   
   </div>