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()
|
||||
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 {
|
||||
// display all repos not on user
|
||||
me.found = new(gitpb.Repos)
|
||||
|
|
|
@ -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()
|
||||
|
|
Loading…
Reference in New Issue