[PATCH 15 of 24] hgweb: generate query strings with parameters sorted by key

Mads Kiilerich mads at kiilerich.com
Sun Dec 16 16:34:10 CST 2012


# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1355276294 -3600
# Node ID f51f3f8ad6d9f5f18d03ced1a25b9296325d5040
# Parent  8578a1efbb0d9e246b4b816ffde2afc8cf2ccd8c
hgweb: generate query strings with parameters sorted by key

diff --git a/mercurial/hgweb/webutil.py b/mercurial/hgweb/webutil.py
--- a/mercurial/hgweb/webutil.py
+++ b/mercurial/hgweb/webutil.py
@@ -340,7 +340,7 @@
         return sessionvars(copy.copy(self.vars), self.start)
     def __iter__(self):
         separator = self.start
-        for key, value in self.vars.iteritems():
+        for key, value in sorted(self.vars.iteritems()):
             yield {'name': key, 'value': str(value), 'separator': separator}
             separator = '&'
 
diff --git a/tests/test-hgweb-commands.t b/tests/test-hgweb-commands.t
--- a/tests/test-hgweb-commands.t
+++ b/tests/test-hgweb-commands.t
@@ -969,8 +969,8 @@
   <a href="/file/cad8025a2e87?style=gitweb">files</a> |
   <a href="/help?style=gitweb">help</a>
   <br/>
-  <a href="/graph/3?style=gitweb&revcount=30">less</a>
-  <a href="/graph/3?style=gitweb&revcount=120">more</a>
+  <a href="/graph/3?revcount=30&style=gitweb">less</a>
+  <a href="/graph/3?revcount=120&style=gitweb">more</a>
   | <a href="/graph/2ef0ac749a14?style=gitweb">(0)</a> <a href="/graph/tip?style=gitweb">tip</a> <br/>
   </div>
   
@@ -1042,8 +1042,8 @@
   </script>
   
   <div class="page_nav">
-  <a href="/graph/3?style=gitweb&revcount=30">less</a>
-  <a href="/graph/3?style=gitweb&revcount=120">more</a>
+  <a href="/graph/3?revcount=30&style=gitweb">less</a>
+  <a href="/graph/3?revcount=120&style=gitweb">more</a>
   | <a href="/graph/2ef0ac749a14?style=gitweb">(0)</a> <a href="/graph/tip?style=gitweb">tip</a> 
   </div>
   


More information about the Mercurial-devel mailing list