start deprecating me.found
This commit is contained in:
parent
66e65c7a00
commit
1a255bdbf6
2
Makefile
2
Makefile
|
@ -32,7 +32,7 @@ install-raw: goimports vet plugin
|
||||||
|
|
||||||
plugin:
|
plugin:
|
||||||
rm -f resources/*.so
|
rm -f resources/*.so
|
||||||
-cp ../../toolkits/gocui/gocui.so resources/
|
# -cp ../../toolkits/gocui/gocui.so resources/
|
||||||
|
|
||||||
andlabs: install
|
andlabs: install
|
||||||
forge --gui andlabs --debugger
|
forge --gui andlabs --debugger
|
||||||
|
|
|
@ -51,9 +51,8 @@ func IsAnythingDirty() bool {
|
||||||
me.found = new(gitpb.Repos)
|
me.found = new(gitpb.Repos)
|
||||||
findAll() // select all the repos
|
findAll() // select all the repos
|
||||||
doCheckDirtyAndConfigSave()
|
doCheckDirtyAndConfigSave()
|
||||||
me.found = new(gitpb.Repos)
|
found := findDirty()
|
||||||
findDirty()
|
if found.Len() == 0 {
|
||||||
if len(me.found.Repos) == 0 {
|
|
||||||
return false
|
return false
|
||||||
} else {
|
} else {
|
||||||
return true
|
return true
|
||||||
|
|
|
@ -15,9 +15,8 @@ func doCommit() {
|
||||||
if argv.All {
|
if argv.All {
|
||||||
log.Info("do a commit everywhere")
|
log.Info("do a commit everywhere")
|
||||||
doCheckDirtyAndConfigSave()
|
doCheckDirtyAndConfigSave()
|
||||||
me.found = new(gitpb.Repos)
|
found := findDirty()
|
||||||
findDirty()
|
all := found.All()
|
||||||
all := me.found.All()
|
|
||||||
for all.Scan() {
|
for all.Scan() {
|
||||||
repo := all.Next()
|
repo := all.Next()
|
||||||
log.Info("do a commit on repo", repo.GetGoPath())
|
log.Info("do a commit on repo", repo.GetGoPath())
|
||||||
|
|
17
doDirty.go
17
doDirty.go
|
@ -14,12 +14,11 @@ import (
|
||||||
func doDirty() {
|
func doDirty() {
|
||||||
findAll() // select all the repos
|
findAll() // select all the repos
|
||||||
doCheckDirtyAndConfigSave()
|
doCheckDirtyAndConfigSave()
|
||||||
me.found = new(gitpb.Repos)
|
found := findDirty()
|
||||||
findDirty()
|
|
||||||
if argv.Verbose {
|
if argv.Verbose {
|
||||||
me.forge.PrintHumanTableDirty(me.found)
|
me.forge.PrintHumanTableDirty(found)
|
||||||
} else {
|
} else {
|
||||||
me.forge.PrintHumanTable(me.found)
|
me.forge.PrintHumanTable(found)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,15 +50,7 @@ func doCheckDirty(repo *gitpb.Repo) error {
|
||||||
|
|
||||||
func doCheckDirtyAndConfigSave() {
|
func doCheckDirtyAndConfigSave() {
|
||||||
start := straightCheckDirty()
|
start := straightCheckDirty()
|
||||||
// log.Info("before findAll()")
|
|
||||||
/*
|
|
||||||
all := me.found.All()
|
|
||||||
for all.Scan() {
|
|
||||||
repo := all.Next()
|
|
||||||
repo.CheckDirty()
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
// this might work?
|
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
me.forge.RillFuncError(doCheckDirty)
|
me.forge.RillFuncError(doCheckDirty)
|
||||||
end := straightCheckDirty()
|
end := straightCheckDirty()
|
||||||
|
|
27
doGui.go
27
doGui.go
|
@ -21,7 +21,7 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func debug() {
|
func debug() {
|
||||||
time.Sleep(5 * time.Second)
|
time.Sleep(2 * time.Second)
|
||||||
for {
|
for {
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
tmp := fmt.Sprintf("All (%d)", me.forge.Repos.Len())
|
tmp := fmt.Sprintf("All (%d)", me.forge.Repos.Len())
|
||||||
|
@ -45,8 +45,9 @@ func debug() {
|
||||||
tmp = fmt.Sprintf("writable (%d)", me.found.Len())
|
tmp = fmt.Sprintf("writable (%d)", me.found.Len())
|
||||||
me.repoWritableB.SetLabel(tmp)
|
me.repoWritableB.SetLabel(tmp)
|
||||||
|
|
||||||
doDirty()
|
doCheckDirtyAndConfigSave()
|
||||||
tmp = fmt.Sprintf("dirty (%d)", me.found.Len())
|
found := findDirty()
|
||||||
|
tmp = fmt.Sprintf("dirty (%d)", found.Len())
|
||||||
me.repoDirtyB.SetLabel(tmp)
|
me.repoDirtyB.SetLabel(tmp)
|
||||||
|
|
||||||
log.Printf("finished a forge scan here in (%s)\n", shell.FormatDuration(time.Since(now)))
|
log.Printf("finished a forge scan here in (%s)\n", shell.FormatDuration(time.Since(now)))
|
||||||
|
@ -197,9 +198,19 @@ func drawWindow(win *gadgets.BasicWindow) {
|
||||||
grid = group2.RawGrid()
|
grid = group2.RawGrid()
|
||||||
|
|
||||||
me.repoDirtyB = grid.NewButton("dirty", func() {
|
me.repoDirtyB = grid.NewButton("dirty", func() {
|
||||||
me.found = new(gitpb.Repos)
|
doCheckDirtyAndConfigSave()
|
||||||
findDirty()
|
found := findDirty()
|
||||||
makeStandardReposWindow("dirty repos", me.found)
|
_, box := makeStandardReposWindow("dirty repos", found)
|
||||||
|
box.NewButton("commit all", func() {
|
||||||
|
all := found.SortByFullPath()
|
||||||
|
for all.Scan() {
|
||||||
|
repo := all.Next()
|
||||||
|
log.Info("do commit here on", repo.GetGoPath())
|
||||||
|
}
|
||||||
|
log.Info("TODO: fix this")
|
||||||
|
log.Info("run 'forge commit --all'")
|
||||||
|
})
|
||||||
|
|
||||||
})
|
})
|
||||||
|
|
||||||
me.repoWritableB = grid.NewButton("writable", func() {
|
me.repoWritableB = grid.NewButton("writable", func() {
|
||||||
|
@ -360,7 +371,7 @@ func makeStandardReposGrid(pb *gitpb.Repos) *gitpb.ReposTable {
|
||||||
}
|
}
|
||||||
|
|
||||||
// this is the magic that generates a window directly from the protocol buffer
|
// this is the magic that generates a window directly from the protocol buffer
|
||||||
func makeStandardReposWindow(title string, pb *gitpb.Repos) *gitpb.ReposTable {
|
func makeStandardReposWindow(title string, pb *gitpb.Repos) (*gitpb.ReposTable, *gui.Node) {
|
||||||
win := gadgets.RawBasicWindow(title)
|
win := gadgets.RawBasicWindow(title)
|
||||||
win.Make()
|
win.Make()
|
||||||
win.Show()
|
win.Show()
|
||||||
|
@ -373,7 +384,7 @@ func makeStandardReposWindow(title string, pb *gitpb.Repos) *gitpb.ReposTable {
|
||||||
t := makeStandardReposGrid(pb)
|
t := makeStandardReposGrid(pb)
|
||||||
t.SetParent(box)
|
t.SetParent(box)
|
||||||
t.ShowTable()
|
t.ShowTable()
|
||||||
return t
|
return t, box
|
||||||
}
|
}
|
||||||
|
|
||||||
func findMergeToDevel() {
|
func findMergeToDevel() {
|
||||||
|
|
24
find.go
24
find.go
|
@ -14,43 +14,43 @@ import (
|
||||||
//
|
//
|
||||||
// by default, it adds every repo
|
// by default, it adds every repo
|
||||||
|
|
||||||
func (f *FindCmd) findRepos() {
|
func (f *FindCmd) findRepos() *gitpb.Repos {
|
||||||
if f == nil {
|
if f == nil {
|
||||||
findMine()
|
findMine()
|
||||||
return
|
return me.found
|
||||||
}
|
}
|
||||||
|
|
||||||
if f.All {
|
if f.All {
|
||||||
findAll()
|
findAll()
|
||||||
return
|
return me.found
|
||||||
}
|
}
|
||||||
|
|
||||||
if f.Private {
|
if f.Private {
|
||||||
findPrivate()
|
findPrivate()
|
||||||
return
|
return me.found
|
||||||
}
|
}
|
||||||
|
|
||||||
if f.Mine {
|
if f.Mine {
|
||||||
findMine()
|
findMine()
|
||||||
return
|
return me.found
|
||||||
}
|
}
|
||||||
|
|
||||||
if f.Favorites {
|
if f.Favorites {
|
||||||
findFavorites()
|
findFavorites()
|
||||||
return
|
return me.found
|
||||||
}
|
}
|
||||||
|
|
||||||
if f.Dirty {
|
if f.Dirty {
|
||||||
findDirty()
|
return findDirty()
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if f.User {
|
if f.User {
|
||||||
findUser()
|
findUser()
|
||||||
return
|
return me.found
|
||||||
}
|
}
|
||||||
|
|
||||||
findAll()
|
findAll()
|
||||||
|
return me.found
|
||||||
}
|
}
|
||||||
|
|
||||||
func findPrivate() {
|
func findPrivate() {
|
||||||
|
@ -89,15 +89,17 @@ func findFavorites() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// finds repos that git is reporting as dirty
|
// finds repos that git is reporting as dirty
|
||||||
func findDirty() {
|
func findDirty() *gitpb.Repos {
|
||||||
|
found := gitpb.NewRepos()
|
||||||
all := me.forge.Repos.SortByFullPath()
|
all := me.forge.Repos.SortByFullPath()
|
||||||
for all.Scan() {
|
for all.Scan() {
|
||||||
var repo *gitpb.Repo
|
var repo *gitpb.Repo
|
||||||
repo = all.Next()
|
repo = all.Next()
|
||||||
if repo.IsDirty() {
|
if repo.IsDirty() {
|
||||||
me.found.AppendByGoPath(repo)
|
found.AppendByGoPath(repo)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return found
|
||||||
}
|
}
|
||||||
|
|
||||||
func findAll() {
|
func findAll() {
|
||||||
|
|
6
main.go
6
main.go
|
@ -152,21 +152,19 @@ func main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if argv.GitFetch != nil {
|
if argv.GitFetch != nil {
|
||||||
// argv.GitPull.findRepos()
|
|
||||||
doGitFetch()
|
doGitFetch()
|
||||||
okExit("")
|
okExit("")
|
||||||
}
|
}
|
||||||
|
|
||||||
if argv.GitPull != nil {
|
if argv.GitPull != nil {
|
||||||
// argv.GitPull.findRepos()
|
|
||||||
doGitPullNew()
|
doGitPullNew()
|
||||||
okExit("")
|
okExit("")
|
||||||
}
|
}
|
||||||
|
|
||||||
if argv.List != nil {
|
if argv.List != nil {
|
||||||
argv.List.findRepos()
|
found := argv.List.findRepos()
|
||||||
// print out the repos
|
// print out the repos
|
||||||
me.forge.PrintHumanTable(me.found)
|
me.forge.PrintHumanTable(found)
|
||||||
okExit("")
|
okExit("")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,9 +62,8 @@ func (r *foundWindow) initWindow() {
|
||||||
group1 := r.stack.NewGroup("Repo Summary")
|
group1 := r.stack.NewGroup("Repo Summary")
|
||||||
group1.NewButton("dirty", func() {
|
group1.NewButton("dirty", func() {
|
||||||
log.Info("find dirty here")
|
log.Info("find dirty here")
|
||||||
me.found = new(gitpb.Repos)
|
found := findDirty()
|
||||||
findDirty()
|
me.forge.PrintHumanTable(found)
|
||||||
me.forge.PrintHumanTable(me.found)
|
|
||||||
})
|
})
|
||||||
group1.NewButton("all", func() {
|
group1.NewButton("all", func() {
|
||||||
log.Info("find all here")
|
log.Info("find all here")
|
||||||
|
|
|
@ -99,9 +99,6 @@ func makeRepoProblemsWindow() *repoProblemsWindow {
|
||||||
group.NewButton("hello", func() {
|
group.NewButton("hello", func() {
|
||||||
log.Info("world")
|
log.Info("world")
|
||||||
})
|
})
|
||||||
group.NewButton("list", func() {
|
|
||||||
log.Info("world")
|
|
||||||
})
|
|
||||||
|
|
||||||
t := makeStandardReposGrid(found)
|
t := makeStandardReposGrid(found)
|
||||||
t.SetParent(box)
|
t.SetParent(box)
|
||||||
|
|
Loading…
Reference in New Issue