grim/hgkeeper

Sort repositories for hgweb

11 months ago, aklitzing
2d5a3940f721
Parents 4ec99415f32b
Children cc7d4b7251eb
Sort repositories for hgweb

Reviewed at https://reviews.imfreedom.org/r/2445/
--- a/access/hgweb.go Tue May 23 00:31:49 2023 -0500
+++ b/access/hgweb.go Tue May 23 00:33:56 2023 -0500
@@ -3,6 +3,7 @@
import (
"fmt"
"os"
+ "sort"
)
func refreshHgWeb() error {
@@ -14,11 +15,17 @@
fmt.Fprintf(fp, "[paths]\n")
- for relativeRepoPath, repoPath := range repositories {
+ keys := make([]string, 0, len(repositories))
+ for k := range repositories {
+ keys = append(keys, k)
+ }
+ sort.Strings(keys)
+
+ for _, relativeRepoPath := range keys {
rootedPath := "/" + relativeRepoPath
// check if it's publicly readable
if CanRead("public", rootedPath) {
- fmt.Fprintf(fp, "%s = %s\n", rootedPath, repoPath)
+ fmt.Fprintf(fp, "%s = %s\n", rootedPath, repositories[relativeRepoPath])
}
}