[sysadmin-bin: 89/168] Sort repositories alphabetically



commit a967a06ae218a257ec4f8895e0a5be9657233552
Author: Owen W. Taylor <otaylor fishsoup net>
Date:   Wed Apr 22 19:45:23 2009 -0400

    Sort repositories alphabetically
    
    Order repositories within each CGIT group alphabetically

 find-cgit-repos |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/find-cgit-repos b/find-cgit-repos
index bcd8f7a..d5a0502 100755
--- a/find-cgit-repos
+++ b/find-cgit-repos
@@ -22,6 +22,10 @@ groups = {}
 for group in grouplist:
     groups[group] = []
 
+# Sort alphabetically by name
+def sort_repos(a, b):
+    return cmp(a[1].lower(), b[1].lower())
+
 def list_repos (paths):
     for path in paths:
         if not os.path.isdir(path):
@@ -53,7 +57,7 @@ def list_repos (paths):
             groups[group].append ((shortname, shortname, desc, repopath))
 
     for group in grouplist:
-        for repo in groups[group]:
+        for repo in sorted(groups[group], sort_repos):
             print 'repo.group=%s' % group
             print 'repo.url=%s' % repo[0]
             print 'repo.name=%s' % repo[1]



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]