summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile1
-rw-r--r--doFind.go13
-rw-r--r--doPull.go35
3 files changed, 47 insertions, 2 deletions
diff --git a/Makefile b/Makefile
index 4c9bbdd..650cb3e 100644
--- a/Makefile
+++ b/Makefile
@@ -60,4 +60,5 @@ devel:
pull: install
forge pull dirty
+ FORGE_URL="http://forge.grid.wit.com:2520/" forge pull
# forge pull patches
diff --git a/doFind.go b/doFind.go
index 8c4acea..c6d11ea 100644
--- a/doFind.go
+++ b/doFind.go
@@ -121,6 +121,19 @@ func findAll() *gitpb.Repos {
return found
}
+func find50() *gitpb.Repos {
+ count := 0
+ found := gitpb.NewRepos()
+ for repo := range me.forge.Repos.IterByFullPath() {
+ found.AppendByGoPath(repo)
+ if count > 50 {
+ return found
+ }
+ count += 1
+ }
+ return found
+}
+
func findUser() *gitpb.Repos {
found := gitpb.NewRepos()
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
}