more rm old code
This commit is contained in:
parent
4efbead37c
commit
f53f1256f1
57
common.go
57
common.go
|
@ -62,3 +62,60 @@ func (rs *RepoStatus) Ready() bool {
|
|||
}
|
||||
return rs.ready
|
||||
}
|
||||
|
||||
// disable all things besides Update() button
|
||||
func (rs *RepoStatus) DisableEverything() {
|
||||
log.Log(INFO, "DisableEverything()")
|
||||
|
||||
// choosing a major, minor or revision
|
||||
rs.major.Disable()
|
||||
rs.minor.Disable()
|
||||
rs.revision.Disable()
|
||||
|
||||
// disable adding a tag message
|
||||
rs.versionMessage.Disable()
|
||||
|
||||
// disable the merge devel to master button
|
||||
rs.develMergeB.Disable()
|
||||
|
||||
// disable the tag a new version button
|
||||
rs.releaseVersion.Disable()
|
||||
}
|
||||
|
||||
// this means devel needs to be merged to master
|
||||
func (rs *RepoStatus) EnableMergeDevel() {
|
||||
rs.DisableEverything()
|
||||
|
||||
rs.develMergeB.Enable()
|
||||
}
|
||||
|
||||
func (rs *RepoStatus) Disable() {
|
||||
rs.window.Disable()
|
||||
}
|
||||
|
||||
func (rs *RepoStatus) Enable() {
|
||||
rs.window.Enable()
|
||||
}
|
||||
|
||||
// this means you need to release a new version of the master repository
|
||||
func (rs *RepoStatus) EnableSelectTag() {
|
||||
rs.DisableEverything()
|
||||
|
||||
// choosing a major, minor or revision
|
||||
rs.major.Enable()
|
||||
rs.minor.Enable()
|
||||
rs.revision.Enable()
|
||||
|
||||
// disable adding a tag message
|
||||
rs.versionMessage.Enable()
|
||||
|
||||
rs.develMergeB.SetLabel("ready to release")
|
||||
|
||||
if len(rs.versionMessage.String()) == 0 {
|
||||
// force there to be a commit message
|
||||
rs.releaseVersion.Disable()
|
||||
} else {
|
||||
// rs.generateCmd()
|
||||
rs.releaseVersion.Enable()
|
||||
}
|
||||
}
|
||||
|
|
28
goConfig.go
28
goConfig.go
|
@ -1,28 +0,0 @@
|
|||
package repostatus
|
||||
|
||||
// does processing on the go.mod and go.sum files
|
||||
|
||||
/*
|
||||
// for now, even check cmd.Exit
|
||||
func (rs *RepoStatus) strictRun(cmd []string) (bool, error) {
|
||||
r := rs.Run(cmd)
|
||||
if r.Error != nil {
|
||||
log.Log(REPO, "go mod init failed err:", r.Error)
|
||||
return false, r.Error
|
||||
}
|
||||
if r.Exit != 0 {
|
||||
log.Log(REPO, "go mod init exit =", r.Exit)
|
||||
return false, r.Error
|
||||
}
|
||||
return true, nil
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
func (rs *RepoStatus) IsReleased() bool {
|
||||
if rs.GetTargetVersion() == rs.GetCurrentVersion() {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
*/
|
|
@ -0,0 +1,32 @@
|
|||
package repostatus
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
func (rs *RepoStatus) setGitCommands() {
|
||||
var line1, line2, line3 []string
|
||||
var all [][]string
|
||||
|
||||
newTag := rs.newversion.String()
|
||||
line1 = append(line1, "git", "tag", "v"+newTag, "-m", rs.versionMessage.String())
|
||||
all = append(all, line1)
|
||||
line2 = append(line2, "git", "push", "--tags")
|
||||
all = append(all, line2)
|
||||
line3 = append(line3, "git", "push", "--prune", "--tags")
|
||||
all = append(all, line3)
|
||||
|
||||
rs.versionCmds = all
|
||||
|
||||
var tmp []string
|
||||
// convert to displayable to the user text
|
||||
for _, line := range all {
|
||||
s := strings.Join(line, " ")
|
||||
log.Log(INFO, "s =", s)
|
||||
tmp = append(tmp, s)
|
||||
}
|
||||
|
||||
rs.versionCmdOutput.SetValue(strings.Join(tmp, "\n"))
|
||||
}
|
|
@ -17,3 +17,20 @@ func (ls *RepoStatus) SetSpeedActual(s string) {
|
|||
}
|
||||
ls.speedActual.SetValue(s)
|
||||
}
|
||||
|
||||
func (rs *RepoStatus) setSpeed(duration time.Duration) {
|
||||
s := fmt.Sprint(duration)
|
||||
if rs.speedActual == nil {
|
||||
log.Log(WARN, "rs.speedActual == nil")
|
||||
return
|
||||
}
|
||||
rs.speedActual.SetValue(s)
|
||||
|
||||
if duration > 200*time.Millisecond {
|
||||
rs.speed.SetValue("SLOW")
|
||||
} else if duration > 50*time.Millisecond {
|
||||
rs.speed.SetValue("OK")
|
||||
} else {
|
||||
rs.speed.SetValue("FAST")
|
||||
}
|
||||
}
|
154
merge.go
154
merge.go
|
@ -1,154 +0,0 @@
|
|||
package repostatus
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
/*
|
||||
func (rs *RepoStatus) recommend() {
|
||||
log.Log(INFO, "Is repo dirty?", rs.dirtyLabel.String())
|
||||
log.Log(INFO, "list the known tags")
|
||||
rs.DisableEverything()
|
||||
rs.populateTags()
|
||||
log.Log(INFO, "Does devel == user?", rs.develBranchVersion.String(), rs.userBranchVersion.String())
|
||||
if rs.develBranchVersion.String() != rs.userBranchVersion.String() {
|
||||
log.Log(INFO, "devel does not equal user")
|
||||
log.Log(INFO, "merge or squash?")
|
||||
rs.EnableMergeDevel()
|
||||
rs.setMergeUserCommands()
|
||||
label := "merge user into " + rs.GetDevelBranchName()
|
||||
rs.develMergeB.SetLabel(label)
|
||||
return
|
||||
}
|
||||
log.Log(INFO, "Does master == devel? ", rs.GetMasterVersion(), rs.GetDevelVersion())
|
||||
if rs.GetMasterVersion() != rs.GetDevelVersion() {
|
||||
log.Log(INFO, "master does not equal devel. merge devel into master")
|
||||
rs.EnableMergeDevel()
|
||||
rs.setMergeDevelCommands()
|
||||
label := "merge devel into " + rs.GetMasterBranchName()
|
||||
rs.develMergeB.SetLabel(label)
|
||||
return
|
||||
}
|
||||
if rs.lasttag.String() != rs.GetMasterVersion() {
|
||||
log.Log(INFO, "master does not equal last tag")
|
||||
rs.incrementRevision()
|
||||
rs.EnableSelectTag()
|
||||
rs.setTag()
|
||||
return
|
||||
}
|
||||
log.Log(INFO, "Is repo pushed upstream? git.wit.org or github?")
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
func (rs *RepoStatus) generateCmd() bool {
|
||||
// the length of 24 is arbitrary, but should be short
|
||||
// they should be things like perhaps, major release names
|
||||
// or something the users might see.
|
||||
// aka: "Topsy", "Picasso", "Buzz", etc
|
||||
|
||||
if !rs.setTag() {
|
||||
log.Log(INFO, "tag sucked. fix your tag version")
|
||||
rs.versionMessage.SetLabel("tag message (bad version)")
|
||||
rs.releaseVersion.Disable()
|
||||
return false
|
||||
}
|
||||
|
||||
log.Log(INFO, "tag is valid!!!!")
|
||||
rs.setGitCommands()
|
||||
|
||||
if rs.versionMessage.String() == "" {
|
||||
log.Log(INFO, "tag message is empty!!!!")
|
||||
rs.releaseVersion.Disable()
|
||||
return false
|
||||
}
|
||||
if len(rs.versionMessage.String()) > 24 {
|
||||
rs.versionMessage.SetLabel("tag message (too long)")
|
||||
} else {
|
||||
rs.versionMessage.SetLabel("tag message")
|
||||
}
|
||||
rs.releaseVersion.SetLabel("Release Tag!")
|
||||
rs.releaseVersion.Enable()
|
||||
return true
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
func (rs *RepoStatus) runGitCommands(verbose bool) bool {
|
||||
var line []string
|
||||
for _, line = range rs.versionCmds {
|
||||
s := strings.Join(line, " ")
|
||||
if verbose {
|
||||
log.Log(WARN, "RUNNING:", s)
|
||||
}
|
||||
rs.develMergeB.SetText(s)
|
||||
r := rs.Run(line)
|
||||
output := strings.TrimSpace(strings.Join(r.Stdout, "\n"))
|
||||
if r.Error != nil {
|
||||
log.Warn("ABEND EXECUTION")
|
||||
log.Warn("error =", r.Error)
|
||||
log.Warn("output =", output)
|
||||
return false
|
||||
}
|
||||
if r.Exit != 0 {
|
||||
log.Warn("Returned with exit =", r.Exit)
|
||||
log.Warn("output was =", output)
|
||||
}
|
||||
log.Log(INFO, "RUN DONE")
|
||||
}
|
||||
return true
|
||||
}
|
||||
*/
|
||||
|
||||
func (rs *RepoStatus) setGitCommands() {
|
||||
var line1, line2, line3 []string
|
||||
var all [][]string
|
||||
|
||||
newTag := rs.newversion.String()
|
||||
line1 = append(line1, "git", "tag", "v"+newTag, "-m", rs.versionMessage.String())
|
||||
all = append(all, line1)
|
||||
line2 = append(line2, "git", "push", "--tags")
|
||||
all = append(all, line2)
|
||||
line3 = append(line3, "git", "push", "--prune", "--tags")
|
||||
all = append(all, line3)
|
||||
|
||||
rs.versionCmds = all
|
||||
|
||||
var tmp []string
|
||||
// convert to displayable to the user text
|
||||
for _, line := range all {
|
||||
s := strings.Join(line, " ")
|
||||
log.Log(INFO, "s =", s)
|
||||
tmp = append(tmp, s)
|
||||
}
|
||||
|
||||
rs.versionCmdOutput.SetValue(strings.Join(tmp, "\n"))
|
||||
}
|
||||
|
||||
/*
|
||||
func (rs *RepoStatus) IsCorrectMode(mode string) bool {
|
||||
switch mode {
|
||||
case "master":
|
||||
if rs.GetCurrentBranchName() == rs.GetMasterBranchName() {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
case "devel":
|
||||
if rs.GetCurrentBranchName() == rs.GetDevelBranchName() {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
case "user":
|
||||
if rs.GetCurrentBranchName() == rs.GetUserBranchName() {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
*/
|
42
mirror.go
42
mirror.go
|
@ -1,42 +0,0 @@
|
|||
package repostatus
|
||||
|
||||
import (
|
||||
"go.wit.com/gui"
|
||||
// "go.wit.com/gui/gui"
|
||||
)
|
||||
|
||||
// this is experiemental work on making 'View's or Table Row's
|
||||
// this may or may not be a good idea
|
||||
|
||||
// returns a widget of the last tag that acts as a mirror
|
||||
func (rs *RepoStatus) MirrorLastTag() *gui.Node {
|
||||
return rs.lasttag.MirrorValue()
|
||||
}
|
||||
|
||||
func (rs *RepoStatus) MirrorTargetVersion() *gui.Node {
|
||||
return rs.targetReleaseVersion.MirrorValue()
|
||||
}
|
||||
|
||||
func (rs *RepoStatus) MirrorCurrentVersion() *gui.Node {
|
||||
return rs.currentVersion.MirrorValue()
|
||||
}
|
||||
|
||||
func (rs *RepoStatus) MirrorCurrentName() *gui.Node {
|
||||
return rs.currentBranch.MirrorValue()
|
||||
}
|
||||
|
||||
func (rs *RepoStatus) MirrorGitState() *gui.Node {
|
||||
return rs.gitState.MirrorValue()
|
||||
}
|
||||
|
||||
func (rs *RepoStatus) MirrorMasterVersion() *gui.Node {
|
||||
return rs.mainBranchVersion.MirrorValue()
|
||||
}
|
||||
|
||||
func (rs *RepoStatus) MirrorDevelVersion() *gui.Node {
|
||||
return rs.develBranchVersion.MirrorValue()
|
||||
}
|
||||
|
||||
func (rs *RepoStatus) MirrorUserVersion() *gui.Node {
|
||||
return rs.userBranchVersion.MirrorValue()
|
||||
}
|
93
update.go
93
update.go
|
@ -2,26 +2,10 @@ package repostatus
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
/*
|
||||
func (rs *RepoStatus) gitBranchAll() {
|
||||
r := rs.Run([]string{"git", "branch", "--all"})
|
||||
if r.Error != nil {
|
||||
log.Log(WARN, "git branch failed string =", rs.Path())
|
||||
log.Log(WARN, "git branch failed realpath =", rs.realPath.String())
|
||||
return
|
||||
}
|
||||
for _, s := range r.Stdout {
|
||||
rs.targetBranch.AddText(s)
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
func (rs *RepoStatus) UpdateNew() {
|
||||
log.Info("gui update", rs.pb.GetFullPath())
|
||||
rs.updateNew()
|
||||
|
@ -68,83 +52,6 @@ func (rs *RepoStatus) Update() {
|
|||
return
|
||||
}
|
||||
log.Log(INFO, "Update() START")
|
||||
duration := timeFunction(func() {
|
||||
rs.updateNew()
|
||||
})
|
||||
rs.setSpeed(duration)
|
||||
log.Log(INFO, "Update() END")
|
||||
}
|
||||
|
||||
func (rs *RepoStatus) setSpeed(duration time.Duration) {
|
||||
s := fmt.Sprint(duration)
|
||||
if rs.speedActual == nil {
|
||||
log.Log(WARN, "rs.speedActual == nil")
|
||||
return
|
||||
}
|
||||
rs.speedActual.SetValue(s)
|
||||
|
||||
if duration > 200*time.Millisecond {
|
||||
rs.speed.SetValue("SLOW")
|
||||
} else if duration > 50*time.Millisecond {
|
||||
rs.speed.SetValue("OK")
|
||||
} else {
|
||||
rs.speed.SetValue("FAST")
|
||||
}
|
||||
}
|
||||
|
||||
// disable all things besides Update() button
|
||||
func (rs *RepoStatus) DisableEverything() {
|
||||
log.Log(INFO, "DisableEverything()")
|
||||
|
||||
// choosing a major, minor or revision
|
||||
rs.major.Disable()
|
||||
rs.minor.Disable()
|
||||
rs.revision.Disable()
|
||||
|
||||
// disable adding a tag message
|
||||
rs.versionMessage.Disable()
|
||||
|
||||
// disable the merge devel to master button
|
||||
rs.develMergeB.Disable()
|
||||
|
||||
// disable the tag a new version button
|
||||
rs.releaseVersion.Disable()
|
||||
}
|
||||
|
||||
// this means devel needs to be merged to master
|
||||
func (rs *RepoStatus) EnableMergeDevel() {
|
||||
rs.DisableEverything()
|
||||
|
||||
rs.develMergeB.Enable()
|
||||
}
|
||||
|
||||
func (rs *RepoStatus) Disable() {
|
||||
rs.window.Disable()
|
||||
}
|
||||
|
||||
func (rs *RepoStatus) Enable() {
|
||||
rs.window.Enable()
|
||||
}
|
||||
|
||||
// this means you need to release a new version of the master repository
|
||||
func (rs *RepoStatus) EnableSelectTag() {
|
||||
rs.DisableEverything()
|
||||
|
||||
// choosing a major, minor or revision
|
||||
rs.major.Enable()
|
||||
rs.minor.Enable()
|
||||
rs.revision.Enable()
|
||||
|
||||
// disable adding a tag message
|
||||
rs.versionMessage.Enable()
|
||||
|
||||
rs.develMergeB.SetLabel("ready to release")
|
||||
|
||||
if len(rs.versionMessage.String()) == 0 {
|
||||
// force there to be a commit message
|
||||
rs.releaseVersion.Disable()
|
||||
} else {
|
||||
// rs.generateCmd()
|
||||
rs.releaseVersion.Enable()
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue