find unregistered repos
This commit is contained in:
parent
0ef88b82d1
commit
3f5fcdf68b
11
main.go
11
main.go
|
@ -22,20 +22,22 @@ func main() {
|
|||
me.myGui.Default()
|
||||
|
||||
me.autotypistWindow = me.myGui.NewWindow("autotypist: it types faster than you can.")
|
||||
box := me.autotypistWindow.NewBox("bw hbox", true)
|
||||
me.mainbox = me.autotypistWindow.NewBox("bw hbox", true)
|
||||
|
||||
vbox1 := box.NewVerticalBox("BOX1")
|
||||
vbox1 := me.mainbox.NewVerticalBox("BOX1")
|
||||
globalDisplayOptions(vbox1)
|
||||
docsBox(vbox1)
|
||||
if debugger.ArgDebug() {
|
||||
debuggerBox(vbox1)
|
||||
}
|
||||
// disable the interface while everything is scanned
|
||||
me.Disable()
|
||||
|
||||
vbox2 := box.NewVerticalBox("BOX2")
|
||||
vbox2 := me.mainbox.NewVerticalBox("BOX2")
|
||||
globalBuildOptions(vbox2)
|
||||
me.summary = submitPatchesBox(vbox2)
|
||||
|
||||
globalResetOptions(box)
|
||||
globalResetOptions(me.mainbox)
|
||||
|
||||
repolistWindow()
|
||||
|
||||
|
@ -46,6 +48,7 @@ func main() {
|
|||
repo.status.Update()
|
||||
repo.newScan()
|
||||
}
|
||||
me.Enable()
|
||||
|
||||
// scan repos every 30 seconds
|
||||
// check every second for the checkbox changing
|
||||
|
|
11
structs.go
11
structs.go
|
@ -8,12 +8,22 @@ import (
|
|||
|
||||
var me *autoType
|
||||
|
||||
func (b *autoType) Disable() {
|
||||
b.mainbox.Disable()
|
||||
}
|
||||
|
||||
func (b *autoType) Enable() {
|
||||
b.mainbox.Enable()
|
||||
}
|
||||
|
||||
// this app's variables
|
||||
type autoType struct {
|
||||
allrepos map[string]*repo
|
||||
myGui *gui.Node
|
||||
|
||||
autotypistWindow *gui.Node
|
||||
// the main box. enable/disable this
|
||||
mainbox *gui.Node
|
||||
|
||||
// the window from the /lib/gui/gowit package
|
||||
lw *gadgets.BasicWindow
|
||||
|
@ -79,6 +89,7 @@ type repo struct {
|
|||
path string
|
||||
lasttagrev string
|
||||
lasttag string
|
||||
giturl string
|
||||
|
||||
pLabel *gui.Node // path label
|
||||
|
||||
|
|
|
@ -6,10 +6,19 @@ import (
|
|||
|
||||
"go.wit.com/gui"
|
||||
"go.wit.com/lib/gadgets"
|
||||
"go.wit.com/lib/gui/gowit"
|
||||
"go.wit.com/lib/gui/repostatus"
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
type patch struct {
|
||||
ref string
|
||||
giturl string
|
||||
comment string
|
||||
rs *repostatus.RepoStatus
|
||||
}
|
||||
|
||||
|
||||
type patchSummary struct {
|
||||
grid *gui.Node
|
||||
updateB *gui.Node
|
||||
|
@ -20,6 +29,9 @@ type patchSummary struct {
|
|||
readonlyOL *gadgets.OneLiner
|
||||
totalPatchesOL *gadgets.OneLiner
|
||||
|
||||
unknownOL *gadgets.OneLiner
|
||||
unknownSubmitB *gui.Node
|
||||
|
||||
reason *gadgets.BasicEntry
|
||||
submitB *gui.Node
|
||||
|
||||
|
@ -44,12 +56,49 @@ func submitPatchesBox(box *gui.Node) *patchSummary {
|
|||
})
|
||||
|
||||
s.updateB = s.grid.NewButton("Check repos are working", func() {
|
||||
me.Disable()
|
||||
defer me.Enable()
|
||||
for _, repo := range me.allrepos {
|
||||
log.Info("Check repo here:", repo.String())
|
||||
return
|
||||
// log.Info("Check repo here:", repo.String())
|
||||
ok, giturl := gowit.CheckRegistered(repo.status)
|
||||
if ok {
|
||||
log.Info("is url correct?", repo.String(), "vs", giturl)
|
||||
repo.giturl = giturl
|
||||
} else {
|
||||
log.Info("repo check failed", repo.String())
|
||||
repo.giturl = "look in .git/config"
|
||||
s.unknownOL.SetText(repo.String())
|
||||
s.unknownOL.Show()
|
||||
s.unknownSubmitB.Show()
|
||||
return
|
||||
}
|
||||
}
|
||||
})
|
||||
s.grid.NextRow()
|
||||
|
||||
s.unknownOL = gadgets.NewOneLiner(s.grid, "Unknown Repo:")
|
||||
s.unknownSubmitB = s.grid.NewButton("Register Repo", func() {
|
||||
log.Info("Submit repo:", s.unknownOL.String())
|
||||
repo, ok := me.allrepos[s.unknownOL.String()]
|
||||
if ok {
|
||||
log.Info("found repo:", repo.String(), "with giturl", repo.giturl)
|
||||
localurl := repo.status.GitURL()
|
||||
if localurl == "" {
|
||||
log.Info("local repo check failed. repo is not uploaded?")
|
||||
} else {
|
||||
log.Info("local repo has", localurl)
|
||||
// attempts to register the unknown repo
|
||||
if gowit.Register(repo.String(), localurl) {
|
||||
s.unknownOL.Hide()
|
||||
s.unknownSubmitB.Hide()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
log.Info("what is this?", s.unknownOL.String())
|
||||
}
|
||||
})
|
||||
s.unknownOL.Hide()
|
||||
s.unknownSubmitB.Hide()
|
||||
s.grid.NextRow()
|
||||
|
||||
s.totalOL = gadgets.NewOneLiner(s.grid, "Total")
|
||||
|
@ -113,12 +162,6 @@ func (s *patchSummary) Update() {
|
|||
}
|
||||
}
|
||||
|
||||
type patch struct {
|
||||
ref string
|
||||
comment string
|
||||
rs *repostatus.RepoStatus
|
||||
}
|
||||
|
||||
func (s *patchSummary) GetPatches() (int, []*patch) {
|
||||
var patchcount int
|
||||
patches := make([]*patch, 0, 0)
|
||||
|
|
Loading…
Reference in New Issue