diff options
Diffstat (limited to 'doPull.go')
| -rw-r--r-- | doPull.go | 26 |
1 files changed, 23 insertions, 3 deletions
@@ -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 { |
