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

login
register
mail settings
Submitter Mads Kiilerich
Date Dec. 16, 2012, 10:34 p.m.
Message ID <f51f3f8ad6d9f5f18d03.1355697250@localhost6.localdomain6>
Download mbox | patch
Permalink /patch/139/
State Accepted
Commit ae7215f4f7b985405e676b5ca70a497ab8e5fa55
Headers show

Comments

Mads Kiilerich - Dec. 16, 2012, 10:34 p.m.
# 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
Bryan O'Sullivan - Dec. 17, 2012, 9:01 p.m.
On Sun, Dec 16, 2012 at 2:34 PM, Mads Kiilerich <mads at kiilerich.com> wrote:

> hgweb: generate query strings with parameters sorted by key
>

Looks good, thanks.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://selenic.com/pipermail/mercurial-devel/attachments/20121217/be46bc6b/attachment.html>

Patch

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>