diff --git a/argv.go b/argv.go index 68c591e..62f7aec 100644 --- a/argv.go +++ b/argv.go @@ -25,7 +25,7 @@ type args struct { GitFetch *FindCmd `arg:"subcommand:fetch" help:"run 'git fetch master'"` List *FindCmd `arg:"subcommand:list" help:"print a table of the current repos"` Merge *MergeCmd `arg:"subcommand:merge" help:"merge branches"` - Normal *EmptyCmd `arg:"subcommand:normal" help:"set every repo to the default state for software development"` + Normal *NormalCmd `arg:"subcommand:normal" help:"set every repo to the default state for software development"` Patch *PatchCmd `arg:"subcommand:patch" help:"make patchsets"` Pull *PullCmd `arg:"subcommand:pull" help:"run 'git pull'"` URL string `arg:"--connect" help:"forge url"` @@ -42,6 +42,11 @@ type args struct { type EmptyCmd struct { } +type NormalCmd struct { + On *EmptyCmd `arg:"subcommand:on" help:"turn normal mode on"` + Off *EmptyCmd `arg:"subcommand:off" help:"turn normal mode off"` +} + type CommitCmd struct { Submit bool `arg:"--submit" default:"true" help:"submit the patches to forge"` } diff --git a/argvAutoshell.go b/argvAutoshell.go index 42e958e..826837b 100644 --- a/argvAutoshell.go +++ b/argvAutoshell.go @@ -43,6 +43,8 @@ func (args) doBashAuto() { fmt.Println("--full") case "merge": fmt.Println("devel master") + case "normal": + fmt.Println("on off") case "pull": fmt.Println("dirty clean list patches --force") case "patch": diff --git a/doFind.go b/doFind.go index b100ecd..6aaaeb2 100644 --- a/doFind.go +++ b/doFind.go @@ -170,6 +170,14 @@ func findReposWithPatches() *gitpb.Repos { // show anything that differs between 'devel' & 'master' branches if repo.GetDevelVersion() != repo.GetMasterVersion() { + // this repo.State code isn't great, but it got me here quickly + // I'll defend my code by saying it's faster for me if I do dumb things + // sometimes and fix them later. Probably some employee will have to + // fix this. if that is the case I owe you lunch. or stock options + if repo.State == "DEVEL behind MASTER" { + // log.Info("repo state", repo.FullPath, repo.State) + continue + } found.AppendByFullPath(repo) continue } diff --git a/main.go b/main.go index 7aa68c1..8a8f2c4 100644 --- a/main.go +++ b/main.go @@ -140,6 +140,27 @@ func main() { } if argv.Normal != nil { + if argv.Normal.On != nil { + if me.forge.Config.Mode == forgepb.ForgeMode_NORMAL { + log.Info("you are already in the normal state") + okExit("") + } + me.forge.Config.Mode = forgepb.ForgeMode_NORMAL + me.forge.Config.ConfigSave() + log.Info("normal mode on") + okExit("") + } + if argv.Normal.Off != nil { + if me.forge.Config.Mode != forgepb.ForgeMode_NORMAL { + log.Info("you were aleady not in the normal state") + okExit("") + } + me.forge.Config.Mode = forgepb.ForgeMode_MASTER + me.forge.Config.ConfigSave() + log.Info("normal mode off") + okExit("") + } + if doNormal() { log.Infof("all %d repos are on your user branch. It is safe to write code now.\n", me.forge.Repos.Len()) if me.forge.Config.Mode != forgepb.ForgeMode_NORMAL {