add repo.IncrementVersion()

This commit is contained in:
Jeff Carr 2024-02-23 00:10:30 -06:00
parent 359ebce26e
commit 5105bd4a99
6 changed files with 34 additions and 21 deletions

View File

@ -158,7 +158,13 @@ func (rs *RepoStatus) GetCurrentVersion() string {
} }
func (rs *RepoStatus) IncrementVersion() bool { func (rs *RepoStatus) IncrementVersion() bool {
return rs.setTag() rs.incrementRevision()
rs.EnableSelectTag()
rs.setTag()
newtag := "v" + rs.newversion.String()
log.Log(REPOWARN, "new version is set to", newtag, "set target version to this")
rs.targetReleaseVersion.SetText(newtag)
return true
} }
// TODO: run this through the sanity check! // TODO: run this through the sanity check!

6
git.go
View File

@ -44,10 +44,10 @@ func (rs *RepoStatus) GitPull() error {
cmd = append(cmd, "git", "pull") cmd = append(cmd, "git", "pull")
err, _, output := RunCmd(rs.realPath.String(), cmd) err, _, output := RunCmd(rs.realPath.String(), cmd)
if err == nil { if err == nil {
log.Log(REPOWARN,"git pull ran", rs.Path()) log.Log(REPOWARN, "git pull ran", rs.Path())
log.Log(REPOWARN,"git pull output", output) log.Log(REPOWARN, "git pull output", output)
} else { } else {
log.Log(REPOWARN,"git pull error", rs.Path(), err) log.Log(REPOWARN, "git pull error", rs.Path(), err)
} }
return err return err
} }

View File

@ -187,7 +187,7 @@ func (rs *RepoStatus) setTag() bool {
return true return true
} }
func (rs *RepoStatus) incrementVersion() { func (rs *RepoStatus) incrementRevision() {
lasttag := rs.lasttag.String() lasttag := rs.lasttag.String()
var major, minor, revision string var major, minor, revision string
if rs.targetReleaseVersion.String() == "" { if rs.targetReleaseVersion.String() == "" {
@ -215,9 +215,10 @@ func (rs *RepoStatus) incrementVersion() {
rs.minor.SetText(widget.GetString(b)) rs.minor.SetText(widget.GetString(b))
// rs.c := strconv.Atoi(revision) // rs.c := strconv.Atoi(revision)
rs.revision.AddText(widget.GetString(c + 1)) rs.revision.AddText(strconv.Itoa(c + 1))
rs.revision.AddText(widget.GetString(c + 2)) rs.revision.AddText(strconv.Itoa(c + 2))
rs.setRevision(widget.GetString(c + 1)) rs.revision.SetText(strconv.Itoa(c + 1))
// rs.setRevision(widget.GetString(c + 1))
} }
func (rs *RepoStatus) recommend() { func (rs *RepoStatus) recommend() {
@ -246,7 +247,7 @@ func (rs *RepoStatus) recommend() {
} }
if rs.lasttag.String() != rs.GetMasterVersion() { if rs.lasttag.String() != rs.GetMasterVersion() {
log.Log(INFO, "master does not equal last tag") log.Log(INFO, "master does not equal last tag")
rs.incrementVersion() rs.incrementRevision()
rs.EnableSelectTag() rs.EnableSelectTag()
rs.setTag() rs.setTag()
return return
@ -280,7 +281,7 @@ func (rs *RepoStatus) generateCmd() bool {
} else { } else {
rs.versionMessage.SetLabel("tag message") rs.versionMessage.SetLabel("tag message")
} }
rs.releaseVersion.SetLabel("Release!") rs.releaseVersion.SetLabel("Release Tag!")
rs.releaseVersion.Enable() rs.releaseVersion.Enable()
return true return true
} }

View File

@ -65,6 +65,9 @@ func (rs *RepoStatus) drawGitCommands(box *gui.Node) {
} }
rs.Enable() rs.Enable()
}) })
newgrid.NewButton("increment version", func() {
rs.IncrementVersion()
})
newgrid.NextRow() newgrid.NextRow()
rs.major = gadgets.NewBasicCombobox(newgrid, "major") rs.major = gadgets.NewBasicCombobox(newgrid, "major")
@ -72,7 +75,7 @@ func (rs *RepoStatus) drawGitCommands(box *gui.Node) {
rs.setTag() rs.setTag()
rs.generateCmd() rs.generateCmd()
} }
rs.major.Hide() // rs.major.Hide()
newgrid.NextRow() newgrid.NextRow()
rs.minor = gadgets.NewBasicCombobox(newgrid, "minor") rs.minor = gadgets.NewBasicCombobox(newgrid, "minor")
@ -80,7 +83,7 @@ func (rs *RepoStatus) drawGitCommands(box *gui.Node) {
rs.setTag() rs.setTag()
rs.generateCmd() rs.generateCmd()
} }
rs.minor.Hide() // rs.minor.Hide()
newgrid.NextRow() newgrid.NextRow()
rs.revision = gadgets.NewBasicCombobox(newgrid, "revision") rs.revision = gadgets.NewBasicCombobox(newgrid, "revision")
@ -88,30 +91,30 @@ func (rs *RepoStatus) drawGitCommands(box *gui.Node) {
rs.setTag() rs.setTag()
rs.generateCmd() rs.generateCmd()
} }
rs.revision.Hide() // rs.revision.Hide()
newgrid.NextRow() newgrid.NextRow()
// newgrid.NewLabel("new tag version") // newgrid.NewLabel("new tag version")
rs.newversion = newgrid.NewLabel("0.0.1") rs.newversion = newgrid.NewLabel("0.0.1")
rs.newversion.Hide() // rs.newversion.Hide()
newgrid.NextRow() newgrid.NextRow()
rs.versionMessage = gadgets.NewBasicEntry(newgrid, "tag message") rs.versionMessage = gadgets.NewBasicEntry(newgrid, "tag message")
rs.versionMessage.Custom = func() { rs.versionMessage.Custom = func() {
rs.generateCmd() rs.generateCmd()
} }
rs.versionMessage.Hide() // rs.versionMessage.Hide()
newgrid.NextRow() newgrid.NextRow()
rs.versionCmdOutput = gadgets.NewOneLiner(newgrid, "tag cmd") rs.versionCmdOutput = gadgets.NewOneLiner(newgrid, "tag cmd")
rs.versionCmdOutput.Hide() // rs.versionCmdOutput.Hide()
newgrid.NextRow() newgrid.NextRow()
rs.releaseVersion = newgrid.NewButton("tag and release new version", func() { rs.releaseVersion = newgrid.NewButton("tag and release new version", func() {
rs.Disable() rs.Disable()
rs.MergeDevelToMaster() rs.MergeDevelToMaster()
}) })
rs.releaseVersion.Hide() // rs.releaseVersion.Hide()
newgrid.NextRow() newgrid.NextRow()
newgrid.Margin() newgrid.Margin()

View File

@ -24,6 +24,7 @@ type Tag struct {
// the .git/ref date // the .git/ref date
date *gui.Node date *gui.Node
duration *gui.Node
// the tag comment // the tag comment
subject *gui.Node subject *gui.Node
@ -122,7 +123,7 @@ func (rs *RepoStatus) makeTagBox(box *gui.Node) {
_, stamp, dur := getGitDateStamp(parts[1]) _, stamp, dur := getGitDateStamp(parts[1])
rTag.date = grid.NewLabel(stamp) rTag.date = grid.NewLabel(stamp)
grid.NewLabel(dur) rTag.duration = grid.NewLabel(dur)
rTag.subject = grid.NewLabel(parts[4]) rTag.subject = grid.NewLabel(parts[4])
rTag.deleteB = grid.NewButton("delete", func() { rTag.deleteB = grid.NewButton("delete", func() {
@ -272,6 +273,7 @@ func (rt *Tag) Hide() {
rt.tag.Hide() rt.tag.Hide()
rt.ref.Hide() rt.ref.Hide()
rt.date.Hide() rt.date.Hide()
rt.duration.Hide()
rt.subject.Hide() rt.subject.Hide()
rt.deleteB.Hide() rt.deleteB.Hide()
} }
@ -281,6 +283,7 @@ func (rt *Tag) Show() {
rt.tag.Show() rt.tag.Show()
rt.ref.Show() rt.ref.Show()
rt.date.Show() rt.date.Show()
rt.duration.Show()
rt.subject.Show() rt.subject.Show()
rt.deleteB.Show() rt.deleteB.Show()
} }