summaryrefslogtreecommitdiff
path: root/doPull.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-06 12:16:39 -0500
committerJeff Carr <[email protected]>2025-10-06 12:16:39 -0500
commitfd9662928abbe7b1f1e6975b7e2e851f955a8b68 (patch)
treeb73b91cfa3c3667d5364c320994d6996fc535d63 /doPull.go
parent3a81d6fa084662b389b798d5ce9f27f55176446a (diff)
more work on pull
Diffstat (limited to 'doPull.go')
-rw-r--r--doPull.go26
1 files changed, 23 insertions, 3 deletions
diff --git a/doPull.go b/doPull.go
index 3892b00..2bc96de 100644
--- a/doPull.go
+++ b/doPull.go
@@ -4,6 +4,7 @@
package main
import (
+ "strings"
"time"
"go.wit.com/lib/gui/shell"
@@ -22,8 +23,12 @@ func updateURL(repo *gitpb.Repo) bool {
}
cmd := []string{"git", "remote", "set-url", "origin", repo.URL}
found.URL = repo.URL
- log.Infof("%s update URL to %v\n", found.URL, cmd)
- found.Run(cmd)
+ if argv.Fix {
+ log.Infof("%s update URL to %v\n", found.URL, cmd)
+ found.Run(cmd)
+ return true
+ }
+ log.Infof("add --fix to update %s with %v\n", found.URL, cmd)
return true
}
@@ -97,11 +102,26 @@ func doPull() error {
var count int
// log.Infof("pull check %s pb.Len()=%d client.Len()=%d server.Len()=%d err=%v\n", regPB.URL, updatepb.Len(), regPB.ClientDataLen, regPB.ServerDataLen, err)
log.Infof("pull check pb.Len()=%d\n", updatepb.Len())
+ updatecheck := gitpb.NewRepos()
for repo := range updatepb.IterAll() {
if updateURL(repo) {
count += 1
+ }
+ if repo.Namespace == "" {
+ log.Info("forge sent back empty namespace", repo)
+ continue
+ }
+ found := me.forge.Repos.FindByNamespace(repo.Namespace)
+ if found == nil {
+ log.Info("you don't have namespace?", repo.Namespace)
+ continue
+ }
+ if !strings.HasPrefix(found.Namespace, "go.wit.com") {
continue
}
+ updatecheck.Append(repo)
+ // spew.Dump(repo)
+ // me.sh.GoodExit("")
/*
found, _ := needToUpdateRepo(repo)
if found == nil {
@@ -121,7 +141,7 @@ func doPull() error {
count += 1
*/
}
- me.forge.SaveRepos()
+ me.forge.PrintPullTable(updatecheck)
return nil
}
if argv.Pull.List != nil {