summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile3
-rw-r--r--applyPatch.go2
-rw-r--r--argv.go6
-rw-r--r--argvAutoshell.go2
-rw-r--r--doCheckout.go2
-rw-r--r--doDirty.go5
-rw-r--r--doPull.go24
-rw-r--r--find.go29
-rw-r--r--main.go2
-rw-r--r--windowFound.go5
10 files changed, 60 insertions, 20 deletions
diff --git a/Makefile b/Makefile
index baeb95e..e993c26 100644
--- a/Makefile
+++ b/Makefile
@@ -57,3 +57,6 @@ identify-protobuf:
devel:
forge clean devel --force --verbose
+
+pull: install
+ forge pull test
diff --git a/applyPatch.go b/applyPatch.go
index 8b05b18..bc40ae3 100644
--- a/applyPatch.go
+++ b/applyPatch.go
@@ -48,8 +48,6 @@ func savePatchset(pset *forgepb.Patchset) error {
// re-run git CheckDirty() on everything
func IsAnythingDirty() bool {
- me.found = new(gitpb.Repos)
- findAll() // select all the repos
doCheckDirtyAndConfigSave()
found := findDirty()
if found.Len() == 0 {
diff --git a/argv.go b/argv.go
index a4ca2ad..17e1500 100644
--- a/argv.go
+++ b/argv.go
@@ -24,7 +24,7 @@ type args struct {
GitFetch *FindCmd `arg:"subcommand:fetch" help:"run 'git fetch master'"`
List *FindCmd `arg:"subcommand:list" help:"print a table of the current repos"`
Patch *PatchCmd `arg:"subcommand:patch" help:"make patchsets"`
- GitPull *FindCmd `arg:"subcommand:pull" help:"run 'git pull'"`
+ GitPull *PullCmd `arg:"subcommand:pull" help:"run 'git pull'"`
Sync *SyncCmd `arg:"subcommand:sync" help:"sync repos with upstream"`
URL string `arg:"--connect" help:"forge url"`
All bool `arg:"--all" help:"git commit --all"`
@@ -67,6 +67,10 @@ type PatchCmd struct {
Submit string `arg:"--submit" help:"submit your commits"`
}
+type PullCmd struct {
+ Test *EmptyCmd `arg:"subcommand:test" help:"list repos that need 'git pull'"`
+}
+
type ConfigAddCmd struct {
Path string `arg:"--path" help:"absolute path of the git repo"`
GoPath string `arg:"--gopath" help:"GO path of the git repo"`
diff --git a/argvAutoshell.go b/argvAutoshell.go
index c69ba70..511c330 100644
--- a/argvAutoshell.go
+++ b/argvAutoshell.go
@@ -46,7 +46,7 @@ func (args) doBashAuto() {
case "list":
fmt.Println("--full")
case "pull":
- fmt.Println("--force")
+ fmt.Println("list --force")
case "patch":
fmt.Println("get list --submit show")
case "user":
diff --git a/doCheckout.go b/doCheckout.go
index fcf095b..49c11f9 100644
--- a/doCheckout.go
+++ b/doCheckout.go
@@ -81,7 +81,7 @@ func IsEverythingOnUser() (int, int, int, error) {
}
func doGitReset() {
- all := me.found.SortByFullPath()
+ all := me.forge.Repos.SortByFullPath()
for all.Scan() {
repo := all.Next()
if me.forge.Config.IsReadOnly(repo.GetGoPath()) {
diff --git a/doDirty.go b/doDirty.go
index bebf456..49acbfe 100644
--- a/doDirty.go
+++ b/doDirty.go
@@ -12,7 +12,6 @@ import (
)
func doDirty() {
- findAll() // select all the repos
doCheckDirtyAndConfigSave()
found := findDirty()
if argv.Verbose {
@@ -26,7 +25,7 @@ func straightCheckDirty() int {
var count int
// var total int
// now := time.Now()
- for repo := range me.found.IterAll() {
+ for repo := range me.forge.Repos.IterAll() {
// total += 1
if repo.IsDirty() {
count += 1
@@ -52,7 +51,7 @@ func doCheckDirtyAndConfigSave() {
now := time.Now()
me.forge.RillFuncError(doCheckDirty)
end := straightCheckDirty()
- log.Printf("dirty check (%d dirty repos) (%d total repos) took:%s\n", end, me.found.Len(), shell.FormatDuration(time.Since(now)))
+ log.Printf("dirty check (%d dirty repos) (%d total repos) took:%s\n", end, me.forge.Repos.Len(), shell.FormatDuration(time.Since(now)))
if start != end {
// todo: use internal forgepb configsave flag. should work?
diff --git a/doPull.go b/doPull.go
index 000728a..35644a6 100644
--- a/doPull.go
+++ b/doPull.go
@@ -4,6 +4,7 @@
package main
import (
+ "fmt"
"time"
"go.wit.com/lib/gui/shell"
@@ -42,7 +43,27 @@ func rillPull(repo *gitpb.Repo) error {
// is every repo on the devel branch?
-func doGitPullNew() {
+func doGitPullNew() error {
+ if argv.GitPull == nil {
+ return fmt.Errorf("not really 'fetch pull'")
+ }
+
+ if argv.GitPull.Test != nil {
+ log.Info("list repo's with updates here")
+ found := doFind()
+ // me.forge.PrintHumanTable(found)
+ me.forge.PrintHumanTableFull(found)
+ /*
+ // print out the repos
+ if argv.List.Full {
+ me.forge.PrintHumanTableFull(found)
+ } else {
+ me.forge.PrintHumanTable(found)
+ }
+ */
+ return nil
+ }
+
now := time.Now()
pullcount := me.forge.RillFuncError(rillPull)
count := me.forge.RillReload()
@@ -52,6 +73,7 @@ func doGitPullNew() {
total, count, nope, _ := IsEverythingOnMaster()
log.Printf("Master branch check. %d total repos. (%d git pulled) (%d not on master branch) (%s) git pull total=%d\n", total, count, nope, shell.FormatDuration(time.Since(now)), pullcount)
+ return nil
}
/*
diff --git a/find.go b/find.go
index 8dbe55b..361541f 100644
--- a/find.go
+++ b/find.go
@@ -14,6 +14,23 @@ import (
//
// by default, it adds every repo
+func doFind() *gitpb.Repos {
+ if argv.List == nil {
+ return findAll()
+ }
+
+ if argv.List.Mine {
+ findMine()
+ return me.found
+ }
+
+ if argv.List.Dirty {
+ return findDirty()
+ }
+
+ return findAll()
+}
+
func (f *FindCmd) findRepos() *gitpb.Repos {
if f == nil {
findMine()
@@ -21,8 +38,7 @@ func (f *FindCmd) findRepos() *gitpb.Repos {
}
if f.All {
- findAll()
- return me.found
+ return findAll()
}
if f.Private {
@@ -49,8 +65,7 @@ func (f *FindCmd) findRepos() *gitpb.Repos {
return me.found
}
- findAll()
- return me.found
+ return findAll()
}
func findPrivate() {
@@ -94,10 +109,12 @@ func findDirty() *gitpb.Repos {
return found
}
-func findAll() {
+func findAll() *gitpb.Repos {
+ found := gitpb.NewRepos()
for repo := range me.forge.Repos.IterByFullPath() {
- me.found.AppendByGoPath(repo)
+ found.AppendByGoPath(repo)
}
+ return found
}
func findUser() {
diff --git a/main.go b/main.go
index faed9c5..74d12fa 100644
--- a/main.go
+++ b/main.go
@@ -125,7 +125,6 @@ func main() {
}
if argv.Clean.GitReset != nil {
- findAll() // select all the repos
doGitReset()
okExit("reset")
}
@@ -188,7 +187,6 @@ func main() {
// basically, if you run just 'forge' it should open the GUI
// if opening the GUI, always check git for dirty repos
- findAll() // select all the repos
doCheckDirtyAndConfigSave()
doGui()
okExit("")
diff --git a/windowFound.go b/windowFound.go
index c79e514..1dfc074 100644
--- a/windowFound.go
+++ b/windowFound.go
@@ -67,9 +67,8 @@ func (r *foundWindow) initWindow() {
})
group1.NewButton("all", func() {
log.Info("find all here")
- me.found = new(gitpb.Repos)
- findAll()
- me.forge.PrintHumanTable(me.found)
+ found := findAll()
+ me.forge.PrintHumanTable(found)
})
r.grid = r.stack.RawGrid()