From eee88af0ce0afd82046985572d2bea0090c7e087 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Tue, 28 Jan 2025 21:15:24 -0600 Subject: [PATCH] general usefulness --- argv.go | 13 ++++++------- argvAutoshell.go | 6 ++---- doPull.go | 2 +- doVerifyDevel.go | 18 ++++++++---------- find.go | 5 ----- main.go | 5 +++++ resources/forge.text | 7 ++----- 7 files changed, 24 insertions(+), 32 deletions(-) diff --git a/argv.go b/argv.go index 57058e9..72e49ff 100644 --- a/argv.go +++ b/argv.go @@ -100,13 +100,12 @@ type DirtyCmd struct { } type FindCmd struct { - Patches *EmptyCmd `arg:"subcommand:patches" help:"show repos that have patches"` - All bool `arg:"--all" help:"select every repo (the default)"` - Mine bool `arg:"--mine" help:"your repos as defined in the forge config"` - Favorites bool `arg:"--favorites" help:"your repos configured as favorites"` - Private bool `arg:"--private" help:"your private repos from your .config/forge/"` - Dirty bool `arg:"--dirty" help:"only use dirty git repos"` - User bool `arg:"--user" help:"show repos on the user branch"` + All bool `arg:"--all" help:"select every repo (the default)"` + Mine bool `arg:"--mine" help:"your repos as defined in the forge config"` + Favorites bool `arg:"--favorites" help:"your repos configured as favorites"` + Private bool `arg:"--private" help:"your private repos from your .config/forge/"` + Dirty bool `arg:"--dirty" help:"only use dirty git repos"` + User bool `arg:"--user" help:"show repos on the user branch"` // ReadOnly bool `arg:"--readonly" help:"include read-only repos"` } diff --git a/argvAutoshell.go b/argvAutoshell.go index e54738a..caef069 100644 --- a/argvAutoshell.go +++ b/argvAutoshell.go @@ -3,7 +3,6 @@ package main import ( "fmt" "os" - "os/user" ) /* @@ -22,8 +21,7 @@ func (args) doBashAuto() { argv.doBashHelp() switch argv.BashAuto[0] { case "checkout": - usr, _ := user.Current() - fmt.Println("user devel master " + usr.Username) + fmt.Println("user devel master ") case "clean": // me.pp.WriteHelp(os.Stderr) // me.pp.WriteUsageForSubcommand(os.Stderr, me.pp.SubcommandNames()...) @@ -41,7 +39,7 @@ func (args) doBashAuto() { case "examine": fmt.Println("fix") case "list": - fmt.Println("--all --mine --favorites --private patches") + fmt.Println("--all --mine --favorites --private") case "pull": fmt.Println("--verbose") case "patch": diff --git a/doPull.go b/doPull.go index 1604800..41e7815 100644 --- a/doPull.go +++ b/doPull.go @@ -14,7 +14,7 @@ func rillPull(repo *gitpb.Repo) error { return nil } t, _ := repo.LastGitPull() - if time.Since(t) < time.Hour { + if time.Since(t) < time.Minute*10 { if argv.Verbose { log.Info(repo.GetFullPath(), "git pulled too recently", shell.FormatDuration(time.Since(t))) } diff --git a/doVerifyDevel.go b/doVerifyDevel.go index b8fd419..f002553 100644 --- a/doVerifyDevel.go +++ b/doVerifyDevel.go @@ -1,8 +1,6 @@ package main import ( - "path/filepath" - "go.wit.com/lib/protobuf/gitpb" "go.wit.com/log" ) @@ -24,14 +22,13 @@ func doVerifyDevel() error { continue } - // check if devel branch exists in remote repo devel := repo.GetDevelBranchName() if argv.Verbose { log.Printf("Start clean devel branch: %s %s\n", repo.GetGoPath(), devel) } - if repo.Exists(filepath.Join(".git/refs/remotes/origin", devel)) { - // todo: actually use .git/config + // check if devel branch exists in remote repo + if repo.IsBranchRemote(devel) { if err := doCleanDevelRepo(repo); err != nil { log.Info(repo.GetGoPath(), "verify clean failed") } @@ -40,11 +37,12 @@ func doVerifyDevel() error { } // devel branch is only local /* - devname := repo.GetDevelBranchName() - if err := requiresGitPush(repo, devname); err != nil { - log.Info(repo.GetGoPath(), "is out of sync with upstream") - return err - } + todo: something? + devname := repo.GetDevelBranchName() + if err := requiresGitPush(repo, devname); err != nil { + log.Info(repo.GetGoPath(), "is out of sync with upstream") + return err + } */ } return nil diff --git a/find.go b/find.go index c81fa60..31659db 100644 --- a/find.go +++ b/find.go @@ -17,11 +17,6 @@ func (f *FindCmd) findRepos() { return } - if argv.List.Patches != nil { - findReposWithPatches() - return - } - if f.All { findAll() return diff --git a/main.go b/main.go index c7338d4..0b78a21 100644 --- a/main.go +++ b/main.go @@ -159,6 +159,11 @@ func main() { log.Info(i, line) } } + if argv.Patch.Show != nil { + findReposWithPatches() + me.forge.PrintHumanTable(me.found) + + } okExit("patch list") } diff --git a/resources/forge.text b/resources/forge.text index 3ad9842..947b5fb 100644 --- a/resources/forge.text +++ b/resources/forge.text @@ -1,10 +1,7 @@ -# this file is automatically re-generated from forge.pb, however, -# if you want to edit it by hand, you can: -# stop forge; remove forge.pb; edit forge.text; start forge -# this will cause the default behavior to fallback to parsing this file for the config - # this file is intended to be used to customize settings on what # git repos you have write access to. That is, where you can run 'git push' +# +# add entries to this using 'forge config' ForgeConfigs: { goPath: "go.wit.com"