From 65a94faa57fc6130fcc4ae6a72081366406ffe88 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sat, 2 Mar 2024 20:47:36 -0600 Subject: [PATCH] increment versions --- merge.go | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/merge.go b/merge.go index db2d1ed..04b4336 100644 --- a/merge.go +++ b/merge.go @@ -182,6 +182,43 @@ func (rs *RepoStatus) SetVersion(a, b, c string, reason string) { // rs.versionMessage.SetValue(reason) } +func (rs *RepoStatus) IncrementMinorVersion(reason string) { + lasttag := rs.lasttag.String() + var major, minor, revision string + major, minor, revision = splitVersion(lasttag) + + olda, _ := strconv.Atoi(major) + oldb, _ := strconv.Atoi(minor) + oldc, _ := strconv.Atoi(revision) + + oldb += 1 + oldc = 0 + + newa := strconv.Itoa(olda) + newb := strconv.Itoa(oldb) + newc := strconv.Itoa(oldc) + + rs.SetVersion(newa, newb, newc, reason) +} + +func (rs *RepoStatus) IncrementRevisionVersion(reason string) { + lasttag := rs.lasttag.String() + var major, minor, revision string + major, minor, revision = splitVersion(lasttag) + + olda, _ := strconv.Atoi(major) + oldb, _ := strconv.Atoi(minor) + oldc, _ := strconv.Atoi(revision) + + oldc += 1 + + newa := strconv.Itoa(olda) + newb := strconv.Itoa(oldb) + newc := strconv.Itoa(oldc) + + rs.SetVersion(newa, newb, newc, reason) +} + func (rs *RepoStatus) setTag() bool { lasttag := rs.lasttag.String() var major, minor, revision string