diff options
| author | Jeff Carr <[email protected]> | 2025-10-06 12:16:39 -0500 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-10-06 12:16:39 -0500 |
| commit | fd9662928abbe7b1f1e6975b7e2e851f955a8b68 (patch) | |
| tree | b73b91cfa3c3667d5364c320994d6996fc535d63 | |
| parent | 3a81d6fa084662b389b798d5ce9f27f55176446a (diff) | |
more work on pull
| -rw-r--r-- | argv.go | 20 | ||||
| -rw-r--r-- | doPull.go | 26 |
2 files changed, 33 insertions, 13 deletions
@@ -16,22 +16,22 @@ import ( var argv args type args struct { - Checkout *CheckoutCmd `arg:"subcommand:checkout" help:"switch branches using 'git checkout'"` - Clean *CleanCmd `arg:"subcommand:reset" help:"reset all git repos to the original state"` - Commit *CommitCmd `arg:"subcommand:commit" help:"'git commit' but errors out if on wrong branch"` + 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'"` Config *ConfigCmd `arg:"subcommand:config" help:"show your .config/forge/ settings"` Gui *EmptyCmd `arg:"subcommand:gui" help:"open the gui"` Merge *MergeCmd `arg:"subcommand:merge" help:"merge branches"` Mode *ModeCmd `arg:"subcommand:mode" help:"sets the mode (hacking, merging, publishing)"` - Patch *PatchCmd `arg:"subcommand:patch" help:"make patchsets"` - Pull *PullCmd `arg:"subcommand:pull" help:"run 'git pull'"` + 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 and add any git repos in your current directory"` - All bool `arg:"--all" help:"git commit --all"` + Add *EmptyCmd `arg:"subcommand:add" help:"Scan directores for git repos"` + 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"` - Fix bool `arg:"--fix" help:"try to fix things"` + Verbose bool `arg:"--verbose" help:"show more output than usual"` + Fix bool `arg:"--fix" help:"try to make repairs"` } func (args) Examples() string { @@ -124,7 +124,7 @@ type SubmitCmd struct { type PullCmd struct { Force bool `arg:"--force" help:"try to strong-arm things"` List *EmptyCmd `arg:"subcommand:list" help:"list repo versions"` - Check *EmptyCmd `arg:"subcommand:check" help:"check for repo changes"` + Check *RepoCmd `arg:"subcommand:check" help:"check for repo changes"` Update *EmptyCmd `arg:"subcommand:update" help:"report updates"` } @@ -4,6 +4,7 @@ package main import ( + "strings" "time" "go.wit.com/lib/gui/shell" @@ -22,8 +23,12 @@ func updateURL(repo *gitpb.Repo) bool { } cmd := []string{"git", "remote", "set-url", "origin", repo.URL} found.URL = repo.URL - log.Infof("%s update URL to %v\n", found.URL, cmd) - found.Run(cmd) + if argv.Fix { + log.Infof("%s update URL to %v\n", found.URL, cmd) + found.Run(cmd) + return true + } + log.Infof("add --fix to update %s with %v\n", found.URL, cmd) return true } @@ -97,11 +102,26 @@ func doPull() error { var count int // log.Infof("pull check %s pb.Len()=%d client.Len()=%d server.Len()=%d err=%v\n", regPB.URL, updatepb.Len(), regPB.ClientDataLen, regPB.ServerDataLen, err) log.Infof("pull check pb.Len()=%d\n", updatepb.Len()) + updatecheck := gitpb.NewRepos() for repo := range updatepb.IterAll() { if updateURL(repo) { count += 1 + } + if repo.Namespace == "" { + log.Info("forge sent back empty namespace", repo) + continue + } + found := me.forge.Repos.FindByNamespace(repo.Namespace) + if found == nil { + log.Info("you don't have namespace?", repo.Namespace) + continue + } + if !strings.HasPrefix(found.Namespace, "go.wit.com") { continue } + updatecheck.Append(repo) + // spew.Dump(repo) + // me.sh.GoodExit("") /* found, _ := needToUpdateRepo(repo) if found == nil { @@ -121,7 +141,7 @@ func doPull() error { count += 1 */ } - me.forge.SaveRepos() + me.forge.PrintPullTable(updatecheck) return nil } if argv.Pull.List != nil { |
