summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-17 04:05:59 -0500
committerJeff Carr <[email protected]>2025-10-17 04:05:59 -0500
commitf051898378892b9a58e36cc28af68200cadde315 (patch)
tree74220e4c9619cc86df7af4608b1edb83650fdc17
parentd02733e0f7fb64fb2dfc68e120e55dfd7fb5405b (diff)
remove "forge checkout". too easy to type instead of git checkout
-rw-r--r--argv.go47
-rw-r--r--doCheckout.go58
-rw-r--r--doCommit.go6
-rw-r--r--doDirty.go7
-rw-r--r--doFix.deleteuser.go3
-rw-r--r--doFix.go4
-rw-r--r--doGui.go4
-rw-r--r--doMode.go19
-rw-r--r--doShow.go8
-rw-r--r--main.go4
-rw-r--r--windowReposNew.go3
11 files changed, 48 insertions, 115 deletions
diff --git a/argv.go b/argv.go
index 8edc1e4..7eb9541 100644
--- a/argv.go
+++ b/argv.go
@@ -19,26 +19,25 @@ import (
var argv args
type args struct {
- Checkout *CheckoutCmd `arg:"subcommand:checkout" help:"'git checkout'"`
- Clean *CleanCmd `arg:"subcommand:clean" help:"'git clean' + reset repos to original state"`
- Commit *CommitCmd `arg:"subcommand:commit" help:"'git commit'"`
- Gui *EmptyCmd `arg:"subcommand:gui" help:"open the gui"`
- Merge *MergeCmd `arg:"subcommand:merge" help:"merge branches"`
- Normal *ModeCmd `arg:"subcommand:normal" help:"shortcut to 'forge mode normal'"`
- Mode *ModeCmd `arg:"subcommand:mode" help:"sets the mode (hacking, merging, publishing)"`
- Patch *PatchCmd `arg:"subcommand:patch" help:"work with patchsets"`
- Pull *PullCmd `arg:"subcommand:pull" help:"'git pull'"`
- Show *ShowCmd `arg:"subcommand:show" help:"print out things"`
- Dev *DevCmd `arg:"subcommand:dev" help:"features under development"`
- Add *EmptyCmd `arg:"subcommand:add" help:"Scan directores for git repos"`
- Fixer *FixCmd `arg:"subcommand:fixer" help:"send in the fixer"`
- Verify *VerifyCmd `arg:"subcommand:verify" help:"populate stats"`
- Whatchanged *EmptyCmd `arg:"subcommand:whatchanged" help:"being deprecated (perhaps?). this is just for finger memory."`
- Rebuild *RebuildCmd `arg:"subcommand:rebuild" help:"download all the forge sources and rebuild forge"`
- All bool `arg:"--all" help:"whatever you are doing, do it all over"`
- Force bool `arg:"--force" help:"try to strong-arm things"`
- Verbose bool `arg:"--verbose" help:"show more output than usual"`
- Fix bool `arg:"--fix" help:"try to make repairs"`
+ Clean *CleanCmd `arg:"subcommand:clean" help:"'git clean' + reset repos to original state"`
+ Commit *CommitCmd `arg:"subcommand:commit" help:"'git commit'"`
+ Gui *EmptyCmd `arg:"subcommand:gui" help:"open the gui"`
+ Merge *MergeCmd `arg:"subcommand:merge" help:"merge branches"`
+ Normal *ModeCmd `arg:"subcommand:normal" help:"shortcut to 'forge mode normal'"`
+ Mode *ModeCmd `arg:"subcommand:mode" help:"sets the mode (hacking, merging, publishing)"`
+ Patch *PatchCmd `arg:"subcommand:patch" help:"work with patchsets"`
+ Pull *PullCmd `arg:"subcommand:pull" help:"'git pull'"`
+ Show *ShowCmd `arg:"subcommand:show" help:"print out things"`
+ Dev *DevCmd `arg:"subcommand:dev" help:"features under development"`
+ Add *EmptyCmd `arg:"subcommand:add" help:"Scan directores for git repos"`
+ Fixer *FixCmd `arg:"subcommand:fixer" help:"send in the fixer"`
+ Verify *VerifyCmd `arg:"subcommand:verify" help:"populate stats"`
+ Whatchanged *EmptyCmd `arg:"subcommand:whatchanged" help:"being deprecated (perhaps?). this is just for finger memory."`
+ Rebuild *RebuildCmd `arg:"subcommand:rebuild" help:"download all the forge sources and rebuild forge"`
+ All bool `arg:"--all" help:"whatever you are doing, do it all over"`
+ Force bool `arg:"--force" help:"try to strong-arm things"`
+ Verbose bool `arg:"--verbose" help:"show more output than usual"`
+ Fix bool `arg:"--fix" help:"try to make repairs"`
}
type EmptyCmd struct {
@@ -147,12 +146,6 @@ type TagCmd struct {
Delete string `arg:"--delete" help:"delete a tag"`
}
-type CheckoutCmd struct {
- User *EmptyCmd `arg:"subcommand:user" help:"git checkout user"`
- Devel *EmptyCmd `arg:"subcommand:devel" help:"git checkout devel"`
- Master *EmptyCmd `arg:"subcommand:master" help:"git checkout master"`
-}
-
type MergeCmd struct {
All bool `arg:"--all" help:"merge all"`
Devel *EmptyCmd `arg:"subcommand:devel" help:"merge user to devel"`
@@ -249,7 +242,7 @@ func (args) Examples() string {
func (a args) SendCompletionStrings(pb *prep.Auto) {
if pb.Cmd == "" {
// these are base autocomplete strings
- matches := []string{"checkout", "clean", "commit", "merge", "patch", "normal", "pull", "rebuild"}
+ matches := []string{"clean", "commit", "merge", "patch", "normal", "pull", "rebuild"}
matches = append(matches, "show", "add", "fixer", "dev", "verify", "mode", "gui", "whatchanged")
matches = append(matches, "--version", "--force", "--all")
pb.SendStrings(matches)
diff --git a/doCheckout.go b/doCheckout.go
deleted file mode 100644
index a661b90..0000000
--- a/doCheckout.go
+++ /dev/null
@@ -1,58 +0,0 @@
-// Copyright 2017-2025 WIT.COM Inc. All rights reserved.
-// Use of this source code is governed by the GPL 3.0
-
-package main
-
-import (
- "fmt"
- "time"
-
- "go.wit.com/lib/gui/shell"
- "go.wit.com/lib/protobuf/forgepb"
- "go.wit.com/lib/protobuf/gitpb"
- "go.wit.com/log"
-)
-
-// trys to figure out if there is still something to update
-
-func didRepoChangeDir(repo *gitpb.Repo) error {
- return repo.DidRepoChangeDir()
-}
-
-func doCheckout() error {
- if argv.Checkout.User != nil {
- me.forge.SetMode(forgepb.ForgeMode_USER)
- start := time.Now()
- err := me.forge.DoAllCheckoutUser(argv.Force)
- dur := time.Since(start)
- log.Printf("Checked out %d user braches in %s\n", me.forge.Repos.Len(), shell.FormatDuration(dur))
- me.forge.ScanRepoDir() // looks for new dirs, checks existing repos for changes
- me.forge.SaveRepos()
- if err != nil {
- badExit(err)
- }
- okExit("")
- }
-
- if argv.Checkout.Devel != nil {
- me.forge.SetMode(forgepb.ForgeMode_DEVEL)
- if err := me.forge.DoAllCheckoutDevelNew(argv.Force); err != nil {
- badExit(err)
- }
- okExit("")
- }
-
- if argv.Checkout.Master != nil {
- me.forge.SetMode(forgepb.ForgeMode_MASTER)
-
- err := me.forge.DoAllCheckoutMaster()
- me.forge.ScanRepoDir() // looks for new dirs, checks existing repos for changes
- me.forge.SaveRepos()
- if err != nil {
- badExit(err)
- }
- okExit("")
- }
- badExit(fmt.Errorf("did not specify what branch to checkout"))
- return nil
-}
diff --git a/doCommit.go b/doCommit.go
index 4a2267c..16e1f78 100644
--- a/doCommit.go
+++ b/doCommit.go
@@ -42,7 +42,7 @@ func doCommit() (string, error) {
if repo.GetCurrentBranchName() != repo.GetUserBranchName() {
found := new(gitpb.Repos)
found.Append(repo)
- footer := me.forge.PrintHumanTable(found)
+ footer := found.PrintDefaultTB()
log.Info(footer)
log.Info("")
log.Info("wrong branch. Can not commit on", repo.GetCurrentBranchName())
@@ -61,8 +61,8 @@ func doCommitRepo(repo *gitpb.Repo) error {
if repo.GetCurrentBranchName() != repo.GetUserBranchName() {
found := new(gitpb.Repos)
found.Append(repo)
- me.forge.PrintHumanTable(found)
- log.Info("")
+ footer := found.PrintDefaultTB()
+ log.Info(footer)
log.Info("wrong branch. Can not commit on", repo.GetCurrentBranchName())
log.Info("")
return nil
diff --git a/doDirty.go b/doDirty.go
index 702302a..dc40e98 100644
--- a/doDirty.go
+++ b/doDirty.go
@@ -10,12 +10,7 @@ func doDirty() (string, error) {
if found.Len() == 0 {
return "nothing dirty", nil
}
- var footer string
- if argv.Verbose {
- footer = me.forge.PrintHumanTableDirty(found)
- } else {
- footer = me.forge.PrintHumanTable(found)
- }
+ footer := found.PrintDefaultTB()
return footer, nil
}
diff --git a/doFix.deleteuser.go b/doFix.deleteuser.go
index 41692d3..f61cfb9 100644
--- a/doFix.deleteuser.go
+++ b/doFix.deleteuser.go
@@ -48,7 +48,8 @@ func doDeleteUser() (string, error) {
}
log.Info("doFixDeleteUserBranches() probably didn't delete it either", err)
}
- me.forge.PrintHumanTable(found)
+ footer := found.PrintDefaultTB()
+ log.Info(footer)
return "TODO: CHECK git patchId to verify these", nil
}
diff --git a/doFix.go b/doFix.go
index d7b314e..1d5f92e 100644
--- a/doFix.go
+++ b/doFix.go
@@ -91,8 +91,8 @@ func doRemoveUntrackedFiles() (string, error) {
repo.State = log.Sprintf("%d files", len(r.Stdout))
found.Append(repo)
}
- me.forge.PrintHumanTable(found)
- log.Info("")
+ footer := found.PrintDefaultTB()
+ log.Info(footer)
log.Info("You have %d files that are untracked excluded git files. They are probably junk.", count)
log.Info("")
log.Info("You can remove these files with '--fix' or list them all with '--verbose'")
diff --git a/doGui.go b/doGui.go
index 384c1f6..da38135 100644
--- a/doGui.go
+++ b/doGui.go
@@ -175,7 +175,6 @@ func findMergeToDevel() *gitpb.Repos {
log.Info("nothing to merge with devel")
return found
}
- // me.forge.PrintHumanTable(found)
// check for merges from devel
total, count, nope, _ := me.forge.IsEverythingOnDevel()
@@ -228,7 +227,8 @@ func findMergeToMaster() *gitpb.Repos {
log.Info("nothing to merge with master")
return found
}
- me.forge.PrintHumanTable(found)
+ footer := found.PrintDefaultTB()
+ log.Info(footer)
// check for merges from devel
total, count, nope, _ := me.forge.IsEverythingOnMaster()
diff --git a/doMode.go b/doMode.go
index f19a094..a1c6279 100644
--- a/doMode.go
+++ b/doMode.go
@@ -5,26 +5,35 @@ package main
import (
"go.wit.com/lib/protobuf/forgepb"
+ "go.wit.com/log"
)
-// FORGE USES THESE TO RECOVER FROM WHEN TOOLKITS FAIL TO LOAD
-// so don't delete them
+// these are the conceptual states for forge
func doMode() (string, error) {
+ var s string
+ var err error
+
if argv.Mode.Normal != nil {
return doNormalAttempt()
}
if argv.Mode.User != nil {
me.forge.SetMode(forgepb.ForgeMode_USER)
+ log.Info("you probably want 'normal'")
return "user mode on", nil
}
if argv.Mode.Devel != nil {
me.forge.SetMode(forgepb.ForgeMode_DEVEL)
- return "devel mode on", nil
+ err = me.forge.DoAllCheckoutDevelNew(argv.Force)
+ s = "devel mode on"
}
if argv.Mode.Master != nil {
me.forge.SetMode(forgepb.ForgeMode_MASTER)
- return "master mode on", nil
+
+ err = me.forge.DoAllCheckoutMaster()
+ me.forge.ScanRepoDir() // looks for new dirs, checks existing repos for changes
+ me.forge.SaveRepos()
+ s = "master mode on"
}
- return "nothing done", nil
+ return s, err
}
diff --git a/doShow.go b/doShow.go
index 1b11f2e..e18b63f 100644
--- a/doShow.go
+++ b/doShow.go
@@ -40,13 +40,9 @@ func doShow() (string, error) {
footer := me.forge.PrintForgedTable(found)
return "repos with patches or unsaved changes: " + footer, nil
}
- var footer string
+
// print out the repos
- if argv.All {
- footer = me.forge.PrintHumanTableFull(found)
- } else {
- footer = me.forge.PrintDefaultTB(found)
- }
+ footer := found.PrintDefaultTB()
return footer, nil
}
diff --git a/main.go b/main.go
index 9b1320b..5ba330b 100644
--- a/main.go
+++ b/main.go
@@ -97,10 +97,6 @@ func main() {
s, err = doCommit()
}
- if argv.Checkout != nil {
- err = doCheckout()
- }
-
if argv.Dev != nil {
s, err = doDev()
}
diff --git a/windowReposNew.go b/windowReposNew.go
index d2d8bfa..78459aa 100644
--- a/windowReposNew.go
+++ b/windowReposNew.go
@@ -70,7 +70,8 @@ func makeReposWinNew() *gadgets.GenericWindow {
t = nil
}
found := findReposWithPatches()
- me.forge.PrintHumanTable(found)
+ footer := found.PrintDefaultTB()
+ log.Info(footer)
// make the window for the first time
t = addWindowPB(insertWin, found)