2024-02-14 00:09:58 -06:00
|
|
|
package repostatus
|
|
|
|
|
|
|
|
import (
|
2024-02-15 22:50:50 -06:00
|
|
|
"go.wit.com/gui"
|
2024-02-14 00:09:58 -06:00
|
|
|
"go.wit.com/lib/gadgets"
|
|
|
|
"go.wit.com/log"
|
|
|
|
)
|
|
|
|
|
2024-02-15 22:50:50 -06:00
|
|
|
func (rs *RepoStatus) drawGitCommands(box *gui.Node) {
|
|
|
|
rs.gitCommandsGroup = box.NewGroup("modify")
|
2024-02-14 00:09:58 -06:00
|
|
|
newgrid := rs.gitCommandsGroup.NewGrid("gridnuts", 0, 0)
|
|
|
|
|
2024-02-16 17:55:13 -06:00
|
|
|
newgrid.NewButton("Rescan Repo", func() {
|
2024-02-20 14:45:43 -06:00
|
|
|
rs.Update()
|
2024-02-14 00:09:58 -06:00
|
|
|
})
|
2024-02-14 00:19:36 -06:00
|
|
|
|
2024-02-14 00:26:58 -06:00
|
|
|
newgrid.NewButton("CheckDirty()", func() {
|
|
|
|
if rs.CheckDirty() {
|
|
|
|
log.Log(WARN, "is dirty")
|
|
|
|
} else {
|
|
|
|
log.Log(WARN, "is not dirty")
|
|
|
|
}
|
|
|
|
})
|
|
|
|
|
|
|
|
newgrid.NewButton("show .git/config", func() {
|
|
|
|
if rs.gitConfig == nil {
|
|
|
|
log.Log(WARN, "Nonexistant or damaged .git/config", rs.String())
|
|
|
|
return
|
|
|
|
}
|
|
|
|
log.Log(WARN, ".git/config:", rs.realPath.String())
|
|
|
|
|
|
|
|
// The info:
|
|
|
|
for name, remote := range rs.gitConfig.remotes {
|
|
|
|
log.Log(WARN, " ", name, "url:", remote.url)
|
|
|
|
}
|
|
|
|
for name, branch := range rs.gitConfig.branches {
|
|
|
|
log.Log(WARN, " ", name, "remote:", branch.remote, "merge", branch.merge)
|
|
|
|
}
|
|
|
|
})
|
2024-02-14 00:09:58 -06:00
|
|
|
newgrid.NextRow()
|
|
|
|
|
|
|
|
newgrid.NewButton("git pull", func() {
|
2024-02-22 17:19:29 -06:00
|
|
|
rs.GitPull()
|
2024-02-14 00:09:58 -06:00
|
|
|
})
|
|
|
|
newgrid.NextRow()
|
|
|
|
|
|
|
|
label := "merge " + rs.userWorkingName.String() + " to " + rs.develWorkingName.String()
|
|
|
|
rs.develMergeB = newgrid.NewButton(label, func() {
|
|
|
|
rs.Disable()
|
2024-02-16 21:20:52 -06:00
|
|
|
if rs.MergeUserToDevel() {
|
2024-02-14 00:09:58 -06:00
|
|
|
log.Warn("THINGS SEEM OK fullAutomation() returned true.")
|
|
|
|
} else {
|
|
|
|
log.Warn("THINGS FAILED fullAutomation() returned false")
|
|
|
|
}
|
|
|
|
rs.Enable()
|
|
|
|
})
|
|
|
|
|
|
|
|
label = "merge " + rs.develWorkingName.String() + " to " + rs.mainWorkingName.String()
|
|
|
|
rs.mainMergeB = newgrid.NewButton(label, func() {
|
|
|
|
rs.Disable()
|
2024-02-16 21:41:15 -06:00
|
|
|
if rs.MergeDevelToMaster() {
|
2024-02-14 00:09:58 -06:00
|
|
|
log.Warn("THINGS SEEM OK fullAutomation() returned true.")
|
|
|
|
} else {
|
|
|
|
log.Warn("THINGS FAILED fullAutomation() returned false")
|
|
|
|
}
|
|
|
|
rs.Enable()
|
|
|
|
})
|
2024-02-23 00:10:30 -06:00
|
|
|
newgrid.NewButton("increment version", func() {
|
|
|
|
rs.IncrementVersion()
|
|
|
|
})
|
2024-02-14 00:09:58 -06:00
|
|
|
newgrid.NextRow()
|
|
|
|
|
|
|
|
rs.major = gadgets.NewBasicCombobox(newgrid, "major")
|
|
|
|
rs.major.Custom = func() {
|
|
|
|
rs.setTag()
|
|
|
|
rs.generateCmd()
|
|
|
|
}
|
2024-02-23 00:10:30 -06:00
|
|
|
// rs.major.Hide()
|
2024-02-14 00:09:58 -06:00
|
|
|
newgrid.NextRow()
|
|
|
|
|
|
|
|
rs.minor = gadgets.NewBasicCombobox(newgrid, "minor")
|
|
|
|
rs.minor.Custom = func() {
|
|
|
|
rs.setTag()
|
|
|
|
rs.generateCmd()
|
|
|
|
}
|
2024-02-23 00:10:30 -06:00
|
|
|
// rs.minor.Hide()
|
2024-02-14 00:09:58 -06:00
|
|
|
newgrid.NextRow()
|
|
|
|
|
|
|
|
rs.revision = gadgets.NewBasicCombobox(newgrid, "revision")
|
|
|
|
rs.revision.Custom = func() {
|
|
|
|
rs.setTag()
|
|
|
|
rs.generateCmd()
|
|
|
|
}
|
2024-02-23 00:10:30 -06:00
|
|
|
// rs.revision.Hide()
|
2024-02-14 00:09:58 -06:00
|
|
|
newgrid.NextRow()
|
|
|
|
|
|
|
|
// newgrid.NewLabel("new tag version")
|
|
|
|
rs.newversion = newgrid.NewLabel("0.0.1")
|
2024-02-23 00:10:30 -06:00
|
|
|
// rs.newversion.Hide()
|
2024-02-14 00:09:58 -06:00
|
|
|
newgrid.NextRow()
|
|
|
|
|
|
|
|
rs.versionMessage = gadgets.NewBasicEntry(newgrid, "tag message")
|
|
|
|
rs.versionMessage.Custom = func() {
|
|
|
|
rs.generateCmd()
|
|
|
|
}
|
2024-02-23 00:10:30 -06:00
|
|
|
// rs.versionMessage.Hide()
|
2024-02-14 00:09:58 -06:00
|
|
|
newgrid.NextRow()
|
|
|
|
|
|
|
|
rs.versionCmdOutput = gadgets.NewOneLiner(newgrid, "tag cmd")
|
2024-02-23 00:10:30 -06:00
|
|
|
// rs.versionCmdOutput.Hide()
|
2024-02-14 00:09:58 -06:00
|
|
|
newgrid.NextRow()
|
|
|
|
|
|
|
|
rs.releaseVersion = newgrid.NewButton("tag and release new version", func() {
|
|
|
|
rs.Disable()
|
2024-02-16 21:28:22 -06:00
|
|
|
rs.MergeDevelToMaster()
|
2024-02-14 00:09:58 -06:00
|
|
|
})
|
2024-02-23 00:10:30 -06:00
|
|
|
// rs.releaseVersion.Hide()
|
2024-02-14 00:09:58 -06:00
|
|
|
newgrid.NextRow()
|
|
|
|
|
|
|
|
newgrid.Margin()
|
|
|
|
newgrid.Pad()
|
|
|
|
}
|