summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-12 00:10:42 -0500
committerJeff Carr <[email protected]>2025-10-12 00:10:42 -0500
commitbb87443f4319e919b83b350292eb8ca3008e58c9 (patch)
treed8ca102a8ce18005cc1344db40aeb4b75749ab43
parent850642580bd5e4d425a66582c86c6730d328580c (diff)
okay
-rw-r--r--Makefile6
-rw-r--r--argv.go2
-rw-r--r--defaultBehavior.go15
-rw-r--r--doMerge.go18
-rw-r--r--doNormal.go20
-rw-r--r--errors.go17
-rw-r--r--find.go9
7 files changed, 48 insertions, 39 deletions
diff --git a/Makefile b/Makefile
index 3a4db19..f757a8e 100644
--- a/Makefile
+++ b/Makefile
@@ -15,6 +15,12 @@ generate: clean
go mod tidy
go generate
+required:
+ go install go.wit.com/apps/autogenpb@latest
+ go install go.wit.com/apps/go-mod-clean@latest
+ go install go.wit.com/apps/go-clone@latest
+ go install golang.org/x/tools/cmd/goimports@latest
+
vet:
@GO111MODULE=off go vet
@echo this go binary package builds okay
diff --git a/argv.go b/argv.go
index ec60872..1ab7dda 100644
--- a/argv.go
+++ b/argv.go
@@ -211,7 +211,7 @@ func (args) Examples() string {
func (a args) DoAutoComplete(pb *prep.Auto) {
if pb.Cmd == "" {
- pb.Autocomplete3([]string{"checkout", "clean", "commit", "gui", "merge", "mode", "patch", "pull", "show", "add", "fixer", "--version", "--force", "dev", "normal"})
+ pb.Autocomplete3([]string{"checkout", "clean", "commit", "gui", "merge", "mode", "patch", "pull", "show", "add", "fixer", "--version", "--force", "dev", "normal", "--all"})
} else {
pb.SubCommand(pb.Goargs...)
}
diff --git a/defaultBehavior.go b/defaultBehavior.go
index 61f3224..0558493 100644
--- a/defaultBehavior.go
+++ b/defaultBehavior.go
@@ -15,16 +15,13 @@ func doDefaultBehavior() (string, error) {
if me.forge.Config.Mode == forgepb.ForgeMode_NORMAL || me.forge.Config.Mode == forgepb.ForgeMode_USER {
// PROBABLY YOU ARE WRITING CODE
// got to the end with nothing to do (?)
- s, err := findWorkRepos()
- // found some repos at least
- // every repo is in a really clean state. no extra files anywhere
- // no dirty repos, no repos that need to be published
- // nothing different between user and master branch version. not common
-
- if err == nil {
- log.Info("All of your git repositories appear to be in perfect shape")
+ found := findWorkRepos()
+ if found.Len() == 0 {
+ return "you have no repos with patches (list them all with --show)", nil
}
- return s, err
+ found.SortNamespace()
+ footer := me.forge.PrintDefaultTB(found)
+ return "repos with patches or unsaved changes: " + footer, nil
}
if me.forge.Config.Mode == forgepb.ForgeMode_MASTER {
diff --git a/doMerge.go b/doMerge.go
index c359ecc..cde6b1e 100644
--- a/doMerge.go
+++ b/doMerge.go
@@ -14,8 +14,6 @@ import (
)
func doMerge() (string, error) {
- var s string
- var err error
if argv.All == true {
start := time.Now()
repos, err := doMergeDevel()
@@ -52,21 +50,19 @@ func doMerge() (string, error) {
return log.Sprintf("Merged %d master branches in %s", repos.Len(), shell.FormatDuration(dur)), nil
}
if argv.Merge.Check != nil {
- err = safeToPublish()
+ err := safeToPublish()
if err == nil {
return "probably safe to publish and merge", nil
}
return "Not safe to Publish.", err
}
- s, err = findWorkRepos()
- // found some repos at least
- if err == nil {
- // every repo is in a really clean state. no extra files anywhere
- // no dirty repos, no repos that need to be published
- // nothing different between user and master branch version. not common
- log.Info("There does't seem to be anything to merge. Your repos are very consistent.")
+ found := findWorkRepos()
+ if found.Len() == 0 {
+ return "There does't seem to be anything to merge. Show your repos with --show", nil
}
- return s, err
+ found.SortNamespace()
+ footer := me.forge.PrintDefaultTB(found)
+ return "repos that can't be merged: " + footer, nil
}
func hashesMatch(repo *gitpb.Repo) error {
diff --git a/doNormal.go b/doNormal.go
index 28bf1a4..e31e015 100644
--- a/doNormal.go
+++ b/doNormal.go
@@ -6,7 +6,6 @@ package main
// checks that repos are in a "normal" state
import (
- "errors"
"fmt"
"path/filepath"
"strings"
@@ -101,22 +100,21 @@ func doNormalOld() bool {
if count > 0 {
log.Info("Some repos are not in a 'normal' state. error count =", count)
log.Info("TODO: list the repos here. forge patch repos?")
- s, err := findWorkRepos()
- _ = s
- _ = err
+ found := findWorkRepos()
+ found.SortNamespace()
+ if found.Len() == 0 {
+ log.Info("you currently have no repos with patches")
+ // return "you currently have no repos with patches", nil
+ }
+ footer := me.forge.PrintDefaultTB(found)
+ log.Info("repos with patches or unsaved changes: " + footer)
+ // return "repos with patches or unsaved changes: " + footer, nil
config.SetChanged("repos", true)
return false
}
return true
}
-var ErrorLocalDevelBranch error = errors.New("devel branch problem")
-var ErrorLocalMasterBranch error = errors.New("master branch problem")
-var ErrorNoUserBranch error = errors.New("no user branch")
-var ErrorNoDevelBranch error = errors.New("no devel branch")
-var ErrorNoMasterBranch error = errors.New("no master branch")
-var ErrorLocalBehindDevel error = errors.New("local behind devel")
-
// 99% of the time, the repos during development should be on your user branch.
// error out if it's not
// this checks to see if a devel and user branch exist
diff --git a/errors.go b/errors.go
new file mode 100644
index 0000000..afcc9dc
--- /dev/null
+++ b/errors.go
@@ -0,0 +1,17 @@
+// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
+// Use of this source code is governed by the GPL 3.0
+
+package main
+
+// checks that repos are in a "normal" state
+
+import (
+ "errors"
+)
+
+var ErrorLocalDevelBranch error = errors.New("devel branch problem")
+var ErrorLocalMasterBranch error = errors.New("master branch problem")
+var ErrorNoUserBranch error = errors.New("no user branch")
+var ErrorNoDevelBranch error = errors.New("no devel branch")
+var ErrorNoMasterBranch error = errors.New("no master branch")
+var ErrorLocalBehindDevel error = errors.New("local behind devel")
diff --git a/find.go b/find.go
index 52a94c9..e036831 100644
--- a/find.go
+++ b/find.go
@@ -283,17 +283,12 @@ func cloneReposWithPatches() *gitpb.Repos {
// - repos with awaiting master branch verions
//
// return true if any are found
-func findWorkRepos() (string, error) {
+func findWorkRepos() *gitpb.Repos {
// always run dirty first
me.forge.CheckDirtyQuiet()
// if no option is given to patch, list out the
// repos that have patches ready in them
found := findReposWithPatches()
- found.SortNamespace()
- if found.Len() == 0 {
- return "you currently have no repos with patches", nil
- }
- footer := me.forge.PrintDefaultTB(found)
- return "repos with patches or unsaved changes: " + footer, nil
+ return found
}