make a 'found repo' window
This commit is contained in:
parent
d17c61ddf3
commit
b4cb43178b
|
@ -165,6 +165,7 @@ func rillCheckoutDevel(repo *gitpb.Repo) error {
|
|||
// is every repo on the devel branch?
|
||||
func doAllCheckoutDevel() error {
|
||||
now := time.Now()
|
||||
log.Info("going to rill:")
|
||||
me.forge.RillFuncError(rillCheckoutDevel)
|
||||
count := me.forge.RillReload()
|
||||
if count != 0 {
|
||||
|
@ -253,6 +254,7 @@ func doAllCheckoutMaster() error {
|
|||
// shared this with the GUI and the command line?
|
||||
func doCheckoutShared() error {
|
||||
if me.argvCheckoutUser {
|
||||
log.Info("Starting git checkout user")
|
||||
if argv.Force {
|
||||
// make the user directories
|
||||
if err := makeUserBranches(); err != nil {
|
||||
|
@ -266,12 +268,13 @@ func doCheckoutShared() error {
|
|||
}
|
||||
|
||||
if me.argvCheckoutDevel {
|
||||
log.Info("Starting git checkout devel")
|
||||
if argv.Force {
|
||||
log.Info("going to force create devel branches")
|
||||
// make the devel directories
|
||||
if err := makeDevelBranches(); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
// this uses rill and is super fast
|
||||
doAllCheckoutDevel()
|
||||
|
@ -279,8 +282,11 @@ func doCheckoutShared() error {
|
|||
}
|
||||
|
||||
if me.argvCheckoutMaster {
|
||||
log.Info("Starting git checkout master")
|
||||
doAllCheckoutMaster()
|
||||
return nil
|
||||
}
|
||||
log.Info("Forge didn't know what branches to checkout")
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -311,6 +317,7 @@ func makeDevelBranches() error {
|
|||
for all.Scan() {
|
||||
repo := all.Next()
|
||||
branch := repo.GetDevelBranchName()
|
||||
log.Info("going to force create devel branches", repo.GetGoPath())
|
||||
if repo.Exists(filepath.Join(".git/refs/heads", branch)) {
|
||||
continue
|
||||
}
|
||||
|
|
12
doGui.go
12
doGui.go
|
@ -145,6 +145,7 @@ func drawWindow(win *gadgets.BasicWindow) {
|
|||
default:
|
||||
me.argvCheckoutUser = true
|
||||
}
|
||||
log.Info("forged changed to default:", me.newBranch.String())
|
||||
}
|
||||
|
||||
// checking this will automatically make the branches off of devel
|
||||
|
@ -176,6 +177,17 @@ func drawWindow(win *gadgets.BasicWindow) {
|
|||
patchWin.Show()
|
||||
})
|
||||
|
||||
var foundWin *foundWindow
|
||||
grid.NewButton("Search Repos", func() {
|
||||
if foundWin != nil {
|
||||
foundWin.Toggle()
|
||||
return
|
||||
}
|
||||
foundWin = new(foundWindow)
|
||||
foundWin.initWindow()
|
||||
foundWin.Show()
|
||||
})
|
||||
|
||||
grid.NewButton("forge ConfigSave()", func() {
|
||||
me.forge.ConfigSave()
|
||||
})
|
||||
|
|
|
@ -0,0 +1,104 @@
|
|||
// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
|
||||
// Use of this source code is governed by the GPL 3.0
|
||||
|
||||
package main
|
||||
|
||||
// shows a window of the 'found' repos
|
||||
|
||||
import (
|
||||
"go.wit.com/lib/gadgets"
|
||||
"go.wit.com/lib/protobuf/gitpb"
|
||||
"go.wit.com/log"
|
||||
|
||||
"go.wit.com/gui"
|
||||
)
|
||||
|
||||
type foundWindow struct {
|
||||
win *gadgets.BasicWindow // the patches window
|
||||
stack *gui.Node // the top box set as vertical
|
||||
grid *gui.Node // the list of available patches
|
||||
reason *gadgets.BasicEntry // the name of the patchset
|
||||
submitB *gui.Node // the submit patchet button
|
||||
psetgrid *gui.Node // the list of each patchset
|
||||
totalOL *gadgets.OneLiner
|
||||
dirtyOL *gadgets.OneLiner
|
||||
readonlyOL *gadgets.OneLiner
|
||||
rw *gadgets.OneLiner
|
||||
// checkB *gui.Node
|
||||
}
|
||||
|
||||
func (r *foundWindow) Hidden() bool {
|
||||
return r.win.Hidden()
|
||||
}
|
||||
|
||||
func (r *foundWindow) Toggle() {
|
||||
if r.Hidden() {
|
||||
r.Show()
|
||||
} else {
|
||||
r.Hide()
|
||||
}
|
||||
}
|
||||
|
||||
func (r *foundWindow) Show() {
|
||||
r.win.Show()
|
||||
}
|
||||
|
||||
func (r *foundWindow) Hide() {
|
||||
r.win.Hide()
|
||||
}
|
||||
|
||||
// you can only have one of these
|
||||
func (r *foundWindow) initWindow() {
|
||||
r.win = gadgets.RawBasicWindow("Found Repos")
|
||||
r.win.Make()
|
||||
|
||||
r.stack = r.win.Box().NewBox("bw vbox", false)
|
||||
// me.reposwin.Draw()
|
||||
r.win.Custom = func() {
|
||||
log.Warn("Found Window close. setting hidden=true")
|
||||
// sets the hidden flag to false so Toggle() works
|
||||
r.win.Hide()
|
||||
}
|
||||
group1 := r.stack.NewGroup("Repo Summary")
|
||||
group1.NewButton("dirty", func() {
|
||||
log.Info("find dirty here")
|
||||
me.found = new(gitpb.Repos)
|
||||
findDirty()
|
||||
me.forge.PrintHumanTable(me.found)
|
||||
})
|
||||
group1.NewButton("all", func() {
|
||||
log.Info("find all here")
|
||||
me.found = new(gitpb.Repos)
|
||||
findAll()
|
||||
me.forge.PrintHumanTable(me.found)
|
||||
})
|
||||
|
||||
r.grid = r.stack.RawGrid()
|
||||
|
||||
group1.NewButton("show", func() {
|
||||
r.listRepos()
|
||||
})
|
||||
}
|
||||
|
||||
func (r *foundWindow) listRepos() {
|
||||
all := me.found.All()
|
||||
for all.Scan() {
|
||||
repo := all.Next()
|
||||
r.addRepo(repo)
|
||||
}
|
||||
}
|
||||
|
||||
func (r *foundWindow) addRepo(repo *gitpb.Repo) {
|
||||
r.grid.NewButton("View", func() {
|
||||
})
|
||||
r.grid.NewLabel(repo.GetGoPath())
|
||||
r.grid.NewLabel(repo.GetMasterVersion())
|
||||
r.grid.NewLabel(repo.GetDevelVersion())
|
||||
r.grid.NewLabel(repo.GetUserVersion())
|
||||
r.grid.NewLabel(repo.GetCurrentBranchName())
|
||||
r.grid.NextRow()
|
||||
}
|
||||
|
||||
// will update this from the current state of the protobuf
|
||||
func (r *foundWindow) Update() {
|
||||
}
|
|
@ -29,8 +29,8 @@ func (r *repoWindow) Hidden() bool {
|
|||
|
||||
func (r *repoWindow) Show() {
|
||||
r.win.Show()
|
||||
now := time.Now()
|
||||
|
||||
now := time.Now()
|
||||
// check for devel branches
|
||||
total, count, nope, _ := IsEverythingOnDevel()
|
||||
log.Printf("Devel branch check. %d total repos. (%d ok) (%d not on devel branch) (%s)\n", total, count, nope, shell.FormatDuration(time.Since(now)))
|
||||
|
@ -215,5 +215,23 @@ func (r *repoWindow) repoMenu() *gui.Node {
|
|||
}
|
||||
me.forge.ConfigSave()
|
||||
})
|
||||
box2.NewButton("update", func() {
|
||||
count := 0
|
||||
r.Disable()
|
||||
defer r.Enable()
|
||||
loop := r.View.ReposSortByName()
|
||||
for loop.Scan() {
|
||||
// var repo *repolist.RepoRow
|
||||
view := loop.Repo()
|
||||
log.Info("doing Update() on", view.GetGoPath())
|
||||
view.Update()
|
||||
view.Hide()
|
||||
view.Show()
|
||||
count += 1
|
||||
if count > 3 {
|
||||
// return
|
||||
}
|
||||
}
|
||||
})
|
||||
return box2
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue