summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--init.go4
-rw-r--r--repoNew.go21
-rw-r--r--rill.go20
-rw-r--r--structs.go3
4 files changed, 20 insertions, 28 deletions
diff --git a/init.go b/init.go
index 220050b..57e18fd 100644
--- a/init.go
+++ b/init.go
@@ -145,6 +145,10 @@ func (f *Forge) InitPB() {
f.forgeURL = os.Getenv("FORGE_URL")
log.Info("got forge url", f.forgeURL)
}
+
+ // todo: play with these / determine good values based on user's machine
+ f.rillX = 10
+ f.rillY = 20
}
func (f *Forge) InitMachine() {
diff --git a/repoNew.go b/repoNew.go
index 96e5bda..9ed3a60 100644
--- a/repoNew.go
+++ b/repoNew.go
@@ -122,13 +122,6 @@ func (f *Forge) findMasterBranch(repo *gitpb.Repo) {
// TODO: figure out the name from git
repo.SetMasterBranchName("master")
- /* no longer checkout on Init()
- if repo.CheckoutMaster() {
- } else {
- cmd := []string{"git", "branch", "master"}
- repo.Run(cmd)
- }
- */
}
// figure out what the name of the git devel branch is
@@ -137,13 +130,6 @@ func (f *Forge) findDevelBranch(repo *gitpb.Repo) {
// check the forge config first
if bname := f.Config.FindDevelBranch(repo.GetGoPath()); bname != "" {
repo.SetDevelBranchName(bname)
- /* no longer checkout on Init()
- if repo.CheckoutDevel() {
- } else {
- cmd := []string{"git", "branch", bname}
- repo.Run(cmd)
- }
- */
return
}
@@ -153,13 +139,6 @@ func (f *Forge) findDevelBranch(repo *gitpb.Repo) {
}
repo.SetDevelBranchName("devel")
- /* no longer checkout on Init()
- if repo.CheckoutDevel() {
- } else {
- cmd := []string{"git", "branch", "devel"}
- repo.Run(cmd)
- }
- */
}
// this is still in flux
diff --git a/rill.go b/rill.go
index cc77d71..2c02149 100644
--- a/rill.go
+++ b/rill.go
@@ -150,13 +150,19 @@ func (f *Forge) RillFuncError(rillf func(*gitpb.Repo) error) int {
return counter
}
+func (f *Forge) ConfigRill(rillX int, rillY int) {
+}
+
// x is the size of the queued up pool (shouldn't matter here for this I think)
// y is how many simultanous functions will run
// todo: tune and compute x,y by # of CPUs and disk io
// todo: store x,y in forge config ? (or compute them. notsure)
-func (f *Forge) RillRepo(rillX int, rillY int, rillf func(*gitpb.Repo) error) (int, error) {
- var anyerr error
+func (f *Forge) RillRepos(rillf func(*gitpb.Repo) error) map[*gitpb.Repo]error {
var all []*gitpb.Repo
+
+ var allerr map[*gitpb.Repo]error
+ allerr = make(map[*gitpb.Repo]error)
+
for repo := range f.Repos.IterAll() {
if !repo.IsValidDir() {
log.Printf("%s %-50s", "got an invalid repo in forgepb.RillFuncError()", repo.GetGoPath())
@@ -173,11 +179,11 @@ func (f *Forge) RillRepo(rillX int, rillY int, rillf func(*gitpb.Repo) error) (i
// Read users from the API.
// Concurrency = 20
- dirs := rill.Map(ids, rillX, func(id *gitpb.Repo) (*gitpb.Repo, error) {
+ dirs := rill.Map(ids, f.rillX, func(id *gitpb.Repo) (*gitpb.Repo, error) {
return id, nil
})
- rill.ForEach(dirs, rillY, func(repo *gitpb.Repo) error {
+ rill.ForEach(dirs, f.rillY, func(repo *gitpb.Repo) error {
meMu.Lock()
counter += 1
if counter > watch {
@@ -186,10 +192,12 @@ func (f *Forge) RillRepo(rillX int, rillY int, rillf func(*gitpb.Repo) error) (i
}
meMu.Unlock()
if err := rillf(repo); err != nil {
- anyerr = err
+ meMu.Lock()
+ allerr[repo] = err
+ meMu.Unlock()
}
return nil
})
- return counter, anyerr
+ return allerr
}
diff --git a/structs.go b/structs.go
index 3a6927e..b924c69 100644
--- a/structs.go
+++ b/structs.go
@@ -22,7 +22,8 @@ type Forge struct {
fullscan time.Time // time of the last scan so it can be throttled
hostname string // your hostname
forgeURL string // URL to use to forge.wit.com
- // Machine *zoopb.Machine // things for virtigo to track vm's
+ rillX int // used for Rill()
+ rillY int // used for Rill()
}
func (f *Forge) GetGoSrc() string {