detect repos to update
This commit is contained in:
parent
807049f6c7
commit
0dea6a2553
1
Makefile
1
Makefile
|
@ -60,4 +60,5 @@ devel:
|
|||
|
||||
pull: install
|
||||
forge pull dirty
|
||||
FORGE_URL="http://forge.grid.wit.com:2520/" forge pull
|
||||
# forge pull patches
|
||||
|
|
13
doFind.go
13
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()
|
||||
|
||||
|
|
35
doPull.go
35
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
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue