summaryrefslogtreecommitdiff
path: root/doRepo.go
diff options
context:
space:
mode:
Diffstat (limited to 'doRepo.go')
-rw-r--r--doRepo.go63
1 files changed, 63 insertions, 0 deletions
diff --git a/doRepo.go b/doRepo.go
new file mode 100644
index 0000000..063fc12
--- /dev/null
+++ b/doRepo.go
@@ -0,0 +1,63 @@
+// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
+// Use of this source code is governed by the GPL 3.0
+
+package main
+
+// An app to submit patches for the 30 GO GUI repos
+
+import (
+ "errors"
+
+ "go.wit.com/lib/env"
+ "go.wit.com/lib/protobuf/forgepb"
+ "go.wit.com/log"
+)
+
+func doRepoRefs(namespace string) error {
+ forge, err := forgepb.Init()
+ if err != nil {
+ errors.Join(err, errors.New("forge init failed"))
+ }
+ env.PrintTable()
+ r := forge.Repos.FindByNamespace(namespace)
+ if r == nil {
+ return errors.New("repo not found")
+ }
+ stats, err := r.LoadRefs()
+ if err != nil {
+ return err
+ }
+
+ if env.True("resort") {
+ stats.SaveByHash()
+ log.Info("stats should have been resorted and saved")
+ } else {
+ footer := stats.PrintTableLimit(10)
+ log.Info("stats footer:", footer)
+
+ err = r.UpdateRefs(stats)
+ if err != nil {
+ // return err
+ }
+ }
+
+ for _, rmote := range r.Config.Remotes {
+ morestats, err := r.MakeRemoteRefs(rmote.Name)
+ if err != nil {
+ // return err
+ }
+ if env.True("resort") {
+ morestats.SaveByHash()
+ log.Info("stats should have been resorted and saved")
+ } else {
+ footer := morestats.PrintTableLimit(10)
+ log.Info("full remote refs footer:", footer)
+ }
+ err = r.UpdateRemoteRefs(rmote.Name)
+ if err != nil {
+ log.Info("update returned err", err)
+ }
+ }
+
+ return nil
+}