disable buttons if things aren't correct
This commit is contained in:
parent
80df33888a
commit
bb865d4a49
|
@ -168,7 +168,7 @@ func doAllCheckoutDevel() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
total, count, nope, err := IsEverythingOnDevel()
|
total, count, nope, err := IsEverythingOnDevel()
|
||||||
log.Printf("Devel branch check. %d total repos. (%d ok) (%d not on user branch) (%s)\n", total, count, nope, shell.FormatDuration(time.Since(now)))
|
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 err != nil {
|
if err != nil {
|
||||||
// display all repos not on user
|
// display all repos not on user
|
||||||
me.found = new(gitpb.Repos)
|
me.found = new(gitpb.Repos)
|
||||||
|
|
|
@ -1,21 +1,23 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
"go.wit.com/lib/gadgets"
|
"go.wit.com/lib/gadgets"
|
||||||
"go.wit.com/lib/gui/repolist"
|
"go.wit.com/lib/gui/repolist"
|
||||||
|
"go.wit.com/lib/gui/shell"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
|
|
||||||
"go.wit.com/gui"
|
"go.wit.com/gui"
|
||||||
)
|
)
|
||||||
|
|
||||||
type repoWindow struct {
|
type repoWindow struct {
|
||||||
win *gadgets.BasicWindow
|
win *gadgets.BasicWindow // the window widget itself
|
||||||
box *gui.Node
|
box *gui.Node // notsure
|
||||||
|
topbox *gui.Node // the top box of the repolist window
|
||||||
// the top box of the repolist window
|
mergeDevel *gui.Node // the buttton for merging user into devel
|
||||||
topbox *gui.Node
|
mergeMaster *gui.Node // the buttton for merging devel into master
|
||||||
|
View *repolist.RepoList // old code
|
||||||
View *repolist.RepoList
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *repoWindow) Hidden() bool {
|
func (r *repoWindow) Hidden() bool {
|
||||||
|
@ -24,6 +26,27 @@ func (r *repoWindow) Hidden() bool {
|
||||||
|
|
||||||
func (r *repoWindow) Show() {
|
func (r *repoWindow) Show() {
|
||||||
r.win.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() {
|
func (r *repoWindow) Hide() {
|
||||||
|
@ -76,7 +99,7 @@ func (r *repoWindow) repoMenu() *gui.Node {
|
||||||
log.Info("filter dirty =", dirty.Checked())
|
log.Info("filter dirty =", dirty.Checked())
|
||||||
}
|
}
|
||||||
|
|
||||||
box2.NewButton("merge user to devel", func() {
|
r.mergeDevel = box2.NewButton("merge to devel", func() {
|
||||||
r.Disable()
|
r.Disable()
|
||||||
defer r.Enable()
|
defer r.Enable()
|
||||||
if IsAnythingDirty() {
|
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.Disable()
|
||||||
// r.mergeAllDevelToMain()
|
// r.mergeAllDevelToMain()
|
||||||
r.Enable()
|
r.Enable()
|
||||||
|
|
Loading…
Reference in New Issue