diff options
Diffstat (limited to 'windowRepos.go')
| -rw-r--r-- | windowRepos.go | 41 |
1 files changed, 32 insertions, 9 deletions
diff --git a/windowRepos.go b/windowRepos.go index f4dae40..bb677be 100644 --- a/windowRepos.go +++ b/windowRepos.go @@ -1,21 +1,23 @@ package main import ( + "time" + "go.wit.com/lib/gadgets" "go.wit.com/lib/gui/repolist" + "go.wit.com/lib/gui/shell" "go.wit.com/log" "go.wit.com/gui" ) type repoWindow struct { - win *gadgets.BasicWindow - box *gui.Node - - // the top box of the repolist window - topbox *gui.Node - - View *repolist.RepoList + win *gadgets.BasicWindow // the window widget itself + box *gui.Node // notsure + topbox *gui.Node // the top box of the repolist window + mergeDevel *gui.Node // the buttton for merging user into devel + mergeMaster *gui.Node // the buttton for merging devel into master + View *repolist.RepoList // old code } func (r *repoWindow) Hidden() bool { @@ -24,6 +26,27 @@ func (r *repoWindow) Hidden() bool { func (r *repoWindow) Show() { r.win.Show() + 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))) + if nope != 0 { + r.mergeDevel.Disable() + } else { + // everything is on the devel branch + r.mergeDevel.Enable() + } + + // check for master branches + total, count, nope, _ = IsEverythingOnMaster() + log.Printf("Master branch check. %d total repos. (%d ok) (%d not on master branch) (%s)\n", total, count, nope, shell.FormatDuration(time.Since(now))) + if nope != 0 { + r.mergeMaster.Disable() + } else { + // everything is on the master branch + r.mergeMaster.Enable() + } } func (r *repoWindow) Hide() { @@ -76,7 +99,7 @@ func (r *repoWindow) repoMenu() *gui.Node { log.Info("filter dirty =", dirty.Checked()) } - box2.NewButton("merge user to devel", func() { + r.mergeDevel = box2.NewButton("merge to devel", func() { r.Disable() defer r.Enable() if IsAnythingDirty() { @@ -91,7 +114,7 @@ func (r *repoWindow) repoMenu() *gui.Node { */ }) - box2.NewButton("test master merge", func() { + r.mergeMaster = box2.NewButton("merge to master", func() { r.Disable() // r.mergeAllDevelToMain() r.Enable() |
