2024-01-09 15:34:53 -06:00
|
|
|
package repostatus
|
|
|
|
|
2024-01-18 00:57:43 -06:00
|
|
|
import (
|
2024-11-15 09:12:47 -06:00
|
|
|
"go.wit.com/log"
|
2024-01-09 15:34:53 -06:00
|
|
|
)
|
|
|
|
|
|
|
|
// reports externally if something has changed
|
|
|
|
// since the last time it was asked about it
|
2024-02-16 17:55:13 -06:00
|
|
|
func (rs *RepoStatus) Changed() (string, bool) {
|
2024-01-18 00:57:43 -06:00
|
|
|
if !rs.Ready() {
|
2024-02-16 17:55:13 -06:00
|
|
|
return "", false
|
2024-01-18 00:57:43 -06:00
|
|
|
}
|
2024-01-19 18:25:37 -06:00
|
|
|
|
2024-02-18 15:09:48 -06:00
|
|
|
return rs.getChanges(), rs.changed
|
2024-02-16 17:55:13 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
// keeps a human readable list of things that have
|
2024-02-18 15:09:48 -06:00
|
|
|
// changed. todo: timestampe these?
|
|
|
|
func (rs *RepoStatus) getChanges() string {
|
2024-02-16 17:55:13 -06:00
|
|
|
return rs.changes
|
|
|
|
}
|
|
|
|
|
|
|
|
func (rs *RepoStatus) NoteChange(s string) {
|
|
|
|
rs.changed = true
|
|
|
|
rs.changes += s + "\n"
|
2024-01-09 15:34:53 -06:00
|
|
|
}
|
|
|
|
|
2024-01-10 18:18:01 -06:00
|
|
|
func (rs *RepoStatus) Show() {
|
2024-01-18 00:57:43 -06:00
|
|
|
if !rs.Ready() {
|
|
|
|
return
|
|
|
|
}
|
2024-01-10 18:18:01 -06:00
|
|
|
log.Log(CHANGE, "Show() window ready =", rs.ready)
|
|
|
|
rs.window.Show()
|
2024-01-09 15:34:53 -06:00
|
|
|
}
|
|
|
|
|
2024-01-10 18:18:01 -06:00
|
|
|
func (rs *RepoStatus) Hide() {
|
2024-01-18 00:57:43 -06:00
|
|
|
if !rs.Ready() {
|
|
|
|
return
|
|
|
|
}
|
2024-01-10 18:18:01 -06:00
|
|
|
log.Log(CHANGE, "Hide() window ready =", rs.ready)
|
|
|
|
rs.window.Hide()
|
2024-01-09 15:34:53 -06:00
|
|
|
}
|
|
|
|
|
2024-01-10 18:18:01 -06:00
|
|
|
func (rs *RepoStatus) Toggle() {
|
2024-01-18 00:57:43 -06:00
|
|
|
if !rs.Ready() {
|
|
|
|
return
|
|
|
|
}
|
2024-01-10 18:18:01 -06:00
|
|
|
log.Log(CHANGE, "Toggle() window ready =", rs.ready)
|
2024-02-11 18:56:55 -06:00
|
|
|
if rs.window.Hidden() {
|
2024-01-10 18:18:01 -06:00
|
|
|
rs.Show()
|
2024-01-09 15:34:53 -06:00
|
|
|
} else {
|
2024-01-10 18:18:01 -06:00
|
|
|
rs.Hide()
|
2024-01-09 15:34:53 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-01-10 18:18:01 -06:00
|
|
|
func (rs *RepoStatus) Ready() bool {
|
2024-01-18 00:57:43 -06:00
|
|
|
if rs == nil {
|
|
|
|
return false
|
|
|
|
}
|
|
|
|
if rs.window == nil {
|
|
|
|
return false
|
|
|
|
}
|
2024-01-10 18:18:01 -06:00
|
|
|
return rs.ready
|
2024-01-09 15:34:53 -06:00
|
|
|
}
|
2025-01-07 19:29:46 -06:00
|
|
|
|
|
|
|
// 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()
|
|
|
|
}
|
|
|
|
}
|