From 197e2a4601dd5f6a232e07618dce41d718f6bb52 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 22 Feb 2024 19:27:20 -0600 Subject: [PATCH 1/4] start cleaning View's --- initRepoList.go | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/initRepoList.go b/initRepoList.go index c538820..9cf08b5 100644 --- a/initRepoList.go +++ b/initRepoList.go @@ -57,10 +57,9 @@ func parsecfg(f string) []string { func splitLine(line string) (string, string, string, string) { var path, master, devel, user string parts := strings.Split(line, " ") - path, parts = repolist.RemoveFirstElement(parts) - master, parts = repolist.RemoveFirstElement(parts) - devel, parts = repolist.RemoveFirstElement(parts) - user, parts = repolist.RemoveFirstElement(parts) - // path, master, devel, user := strings.Split(line, " ") + path, parts = shell.RemoveFirstElement(parts) + master, parts = shell.RemoveFirstElement(parts) + devel, parts = shell.RemoveFirstElement(parts) + user, parts = shell.RemoveFirstElement(parts) return path, master, devel, user } From f68e76b9142af35fb0cb8ff09ac330a2f7ac2f17 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 22 Feb 2024 21:10:33 -0600 Subject: [PATCH 2/4] move to common repolist code --- initRepoList.go | 46 ++-------------------------------------------- repoview.go | 2 +- 2 files changed, 3 insertions(+), 45 deletions(-) diff --git a/initRepoList.go b/initRepoList.go index 9cf08b5..6d81149 100644 --- a/initRepoList.go +++ b/initRepoList.go @@ -3,35 +3,14 @@ package main // this initializes the repos import ( - "io/ioutil" - "os" - "os/user" - "path/filepath" "strings" - "go.wit.com/lib/gui/repolist" "go.wit.com/lib/gui/repostatus" "go.wit.com/log" ) func (r *repoWindow) initRepoList() { - usr, _ := user.Current() - - repos := parsecfg("~/.config/guireleaser") - for _, line := range repos { - log.Verbose("repo =", line) - path, mbranch, dbranch, ubranch := splitLine(line) - if mbranch == "" { - mbranch = "master" - } - if dbranch == "" { - dbranch = "devel" - } - if ubranch == "" { - ubranch = usr.Username - } - r.View.AddRepo(path, mbranch, dbranch, ubranch) - } + r.View.InitRepoList("~/.config/guireleaser") log.Info("scanning everything in ~/go/src") for i, path := range repostatus.ListGitDirectories() { @@ -39,27 +18,6 @@ func (r *repoWindow) initRepoList() { path = strings.TrimPrefix(path, me.goSrcPwd.String()) path = strings.Trim(path, "/") log.Info("addRepo()", i, path) - r.View.AddRepo(path, "master", "devel", usr.Username) + r.View.NewRepo(path) } } - -func parsecfg(f string) []string { - homeDir, _ := os.UserHomeDir() - cfgfile := filepath.Join(homeDir, f) - content, _ := ioutil.ReadFile(cfgfile) - out := string(content) - out = strings.TrimSpace(out) - lines := strings.Split(out, "\n") - return lines -} - -// returns path, master branch name, devel branch name, user branch name -func splitLine(line string) (string, string, string, string) { - var path, master, devel, user string - parts := strings.Split(line, " ") - path, parts = shell.RemoveFirstElement(parts) - master, parts = shell.RemoveFirstElement(parts) - devel, parts = shell.RemoveFirstElement(parts) - user, parts = shell.RemoveFirstElement(parts) - return path, master, devel, user -} diff --git a/repoview.go b/repoview.go index 95dc288..2dfe6c3 100644 --- a/repoview.go +++ b/repoview.go @@ -2,8 +2,8 @@ package main import ( "go.wit.com/lib/gadgets" - "go.wit.com/lib/gui/repolist" "go.wit.com/lib/gui/gowit" + "go.wit.com/lib/gui/repolist" "go.wit.com/log" "go.wit.com/gui" From 3c1d0321013fc84b06d23ff27f6efb9e8cc9d7b1 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 23 Feb 2024 01:22:46 -0600 Subject: [PATCH 3/4] start Increment all tags --- globalDisplayOptions.go | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/globalDisplayOptions.go b/globalDisplayOptions.go index 94f4332..398cd7e 100644 --- a/globalDisplayOptions.go +++ b/globalDisplayOptions.go @@ -87,7 +87,7 @@ func globalDisplayOptions(box *gui.Node) { hidegrid.NextRow() group1 = vbox.NewGroup("prep for release") - grid := group1.NewGrid("test", 0, 0) + grid := group1.RawGrid() var longB *gui.Node longB = grid.NewButton("generate go.sum files", func() { @@ -120,6 +120,32 @@ func globalDisplayOptions(box *gui.Node) { } }) + grid.NewButton("increment tags", func() { + for _, repo := range me.repos.View.AllRepos() { + if whitelist(repo.GoPath()) { + continue + } + if repo.ReadOnly() { + continue + } + lasttag := repo.LastTag() + masterv := repo.Status.GetMasterVersion() + targetv := repo.Status.GetTargetVersion() + + if lasttag == masterv { + // nothing to do if curv == masterv + // unless go.sum depends on changed repos + continue + } + + if masterv != targetv { + log.Info(repo.GoPath(), "master and target differ already", masterv, targetv) + // already incremented + continue + } + repo.Status.IncrementVersion() + } + }) grid.NextRow() group2 := vbox.NewGroup("Debugger") From 25681e479898616e44e8d60e46cc36a89a1e0ae7 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 23 Feb 2024 07:25:57 -0600 Subject: [PATCH 4/4] allow simple version increments --- globalDisplayOptions.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/globalDisplayOptions.go b/globalDisplayOptions.go index 398cd7e..a985141 100644 --- a/globalDisplayOptions.go +++ b/globalDisplayOptions.go @@ -138,12 +138,20 @@ func globalDisplayOptions(box *gui.Node) { continue } + newversion := repo.Status.GetNewVersionTag() + if newversion == targetv { + log.Info(repo.GoPath(), "targetv has been increased already to", targetv) + continue + } + if masterv != targetv { - log.Info(repo.GoPath(), "master and target differ already", masterv, targetv) + log.Info(repo.GoPath(), "master and target differ", masterv, targetv) + repo.Status.IncrementVersion() + newversion := repo.Status.GetNewVersionTag() + repo.Status.SetTargetVersion(newversion) // already incremented continue } - repo.Status.IncrementVersion() } }) grid.NextRow()