From 70780666911c300fa79eb3df9e3c164537ff9818 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Thu, 22 Feb 2024 15:54:00 -0600 Subject: [PATCH] lazy code move to shell --- globalBuildOptions.go | 2 +- handleCmdLine.go | 12 ++++++++++++ initRepoList.go | 10 +++++----- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/globalBuildOptions.go b/globalBuildOptions.go index fd445b2..bff00b0 100644 --- a/globalBuildOptions.go +++ b/globalBuildOptions.go @@ -100,7 +100,7 @@ func globalBuildOptions(vbox *gui.Node) { log.Info("but branch exists so something went wrong") continue } - if ! me.autoCreateBranches.Checked() { + if !me.autoCreateBranches.Checked() { log.Info("not auto creating branch", targetName) continue } diff --git a/handleCmdLine.go b/handleCmdLine.go index fdafcbe..e41fe8c 100644 --- a/handleCmdLine.go +++ b/handleCmdLine.go @@ -40,6 +40,10 @@ func argCheckoutDevel() bool { me.autotypistWindow.Hide() var failed int = 0 for _, repo := range repolist.AllRepos() { + if repo.Status.ReadOnly() { + // log.Info("skipping read-only", repo.Name()) + continue + } if repo.CheckDirty() { log.Info("skipping dirty repo", repo.Name()) continue @@ -67,11 +71,19 @@ func argCheckoutUser() bool { me.autotypistWindow.Hide() var failed int = 0 for _, repo := range repolist.AllRepos() { + if repo.Status.ReadOnly() { + // log.Info("skipping read-only", repo.Name()) + continue + } if repo.Status.CheckDirty() { log.Info("skipping dirty repo", repo.Name()) continue } branch := repo.Status.GetUserBranchName() + if branch == repo.Status.GetCurrentBranchName() { + // already on user branch + continue + } cmd := []string{"git", "checkout", branch} log.Info("Running:", cmd, "in", repo.Name()) err, output := repo.RunCmd(cmd) diff --git a/initRepoList.go b/initRepoList.go index befe28c..2f33f3f 100644 --- a/initRepoList.go +++ b/initRepoList.go @@ -9,8 +9,8 @@ import ( "path/filepath" "strings" - "go.wit.com/lib/gui/repolist" "go.wit.com/lib/gui/repostatus" + "go.wit.com/lib/gui/shell" "go.wit.com/log" ) @@ -61,10 +61,10 @@ 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, parts = shell.RemoveFirstElement(parts) + master, parts = shell.RemoveFirstElement(parts) + devel, parts = shell.RemoveFirstElement(parts) + user, parts = shell.RemoveFirstElement(parts) // path, master, devel, user := strings.Split(line, " ") return path, master, devel, user }