summaryrefslogtreecommitdiff
path: root/doPull.go
diff options
context:
space:
mode:
Diffstat (limited to 'doPull.go')
-rw-r--r--doPull.go35
1 files changed, 33 insertions, 2 deletions
diff --git a/doPull.go b/doPull.go
index fe581cb..bbeb8ed 100644
--- a/doPull.go
+++ b/doPull.go
@@ -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
}