summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--argv.go20
-rw-r--r--doPull.go26
2 files changed, 33 insertions, 13 deletions
diff --git a/argv.go b/argv.go
index 268a598..1aeffbf 100644
--- a/argv.go
+++ b/argv.go
@@ -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"`
}
diff --git a/doPull.go b/doPull.go
index 3892b00..2bc96de 100644
--- a/doPull.go
+++ b/doPull.go
@@ -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 {