diff options
Diffstat (limited to 'doPull.go')
| -rw-r--r-- | doPull.go | 35 |
1 files changed, 33 insertions, 2 deletions
@@ -72,15 +72,46 @@ func doGitPullNew() error { } if check.Len() == 0 { - check = doFind() + // check = doFind() + check = findAll() + // check = find50() + // check = findMine() } me.forge.PrintHumanTableFull(check) found, err := me.forge.LookupPB(check) if err != nil { + log.Info("LookupPB() failed", err, "len(check)=", check.Len()) + return err + } + // me.forge.PrintHumanTableFull(found) + + // check to see if the repos need to be updated + update := gitpb.NewRepos() + + for repo := range found.IterAll() { + a := repo.GetLocalHash(repo.GetMasterBranchName()) + ns := repo.GetNamespace() + repo2 := me.forge.Repos.FindByNamespace(ns) + if repo2 == nil { + log.Info("repo namespace does not exist", a, repo.Namespace) + continue + } + b := repo2.GetLocalHash(repo2.GetMasterBranchName()) + if b == a { + continue + } + log.Info(a, "!=", b, repo.Namespace) + update.AppendByNamespace(repo2) + } + if update.Len() == 0 { + // nothing to update + return nil + } + if _, err := me.forge.UpdatePB(update); err != nil { + log.Info("UpdatePB() failed", err, "len(check)=", update.Len()) return err } - me.forge.PrintHumanTableFull(found) return nil } |
