diff mercurial/hgweb/webcommands.py @ 6762:f67d1468ac50

util: add sort helper
author Matt Mackall <mpm@selenic.com>
date Fri, 27 Jun 2008 18:28:45 -0500
parents fb42030d79d6
children e8c2dae47799
line wrap: on
line diff
--- a/mercurial/hgweb/webcommands.py	Fri Jun 27 14:53:30 2008 -0500
+++ b/mercurial/hgweb/webcommands.py	Fri Jun 27 18:28:45 2008 -0500
@@ -13,7 +13,7 @@
 from mercurial.repo import RepoError
 from common import paritygen, staticfile, get_contact, ErrorResponse
 from common import HTTP_OK, HTTP_NOT_FOUND
-from mercurial import graphmod
+from mercurial import graphmod, util
 
 # __all__ is populated with the allowed commands. Be sure to add to it if
 # you're adding a new command, or the new command won't work.
@@ -288,9 +288,7 @@
         raise ErrorResponse(HTTP_NOT_FOUND, 'path not found: ' + path)
 
     def filelist(**map):
-        fl = files.keys()
-        fl.sort()
-        for f in fl:
+        for f in util.sort(files):
             full, fnode = files[f]
             if not fnode:
                 continue
@@ -304,9 +302,7 @@
                    "permissions": mf.flags(full)}
 
     def dirlist(**map):
-        fl = files.keys()
-        fl.sort()
-        for f in fl:
+        for f in util.sort(files):
             full, fnode = files[f]
             if fnode:
                 continue
@@ -378,9 +374,7 @@
 
         b = web.repo.branchtags()
         l = [(-web.repo.changelog.rev(n), n, t) for t, n in b.items()]
-        l.sort()
-
-        for r,n,t in l:
+        for r,n,t in util.sort(l):
             yield {'parity': parity.next(),
                    'branch': t,
                    'node': hex(n),