summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-12-03 13:23:12 -0600
committerJeff Carr <[email protected]>2024-12-03 13:23:12 -0600
commitd1cc3bd09a78bc83f8fa50af267c15bebac880df (patch)
tree40599463d3416d959b790211a5d69d62b9dc8762
parentc2bd3b64be97cb5a58e9b3271339b5f75d8ccc0a (diff)
on the way to somewherev0.22.5
-rw-r--r--Makefile6
-rw-r--r--argv.go2
-rw-r--r--list.go11
-rw-r--r--main.go14
-rw-r--r--repomap.go7
5 files changed, 30 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index 007eee0..484f025 100644
--- a/Makefile
+++ b/Makefile
@@ -36,6 +36,12 @@ redomod:
GO111MODULE= go mod init
GO111MODULE= go mod tidy
+redomod-all:
+ ./forge --RedoGoMod
+
+redomod-erase:
+ ./forge --RedoGoMod --erase
+
list: build
reset
./forge --list
diff --git a/argv.go b/argv.go
index 9f79d48..0237182 100644
--- a/argv.go
+++ b/argv.go
@@ -21,6 +21,8 @@ type args struct {
Real bool `arg:"--fix" help:"fix config, save config & exit"`
Repomap string `arg:"--repomap" help:"parse a repomap from gowebd"`
Clone bool `arg:"--clone" help:"go-clone things you are missing"`
+ Force bool `arg:"--force" help:"force redo go-clone"`
+ Erase bool `arg:"--erase" help:"erase"`
}
func (args) Version() string {
diff --git a/list.go b/list.go
index 4e4cca4..da733ad 100644
--- a/list.go
+++ b/list.go
@@ -51,13 +51,20 @@ func verifyPrint(repo *gitpb.Repo) {
os.Exit(0)
}
}
- if me.forge.IsReadOnly(repo.GoPath) && !argv.ReadOnly {
+ if me.forge.IsReadOnly(repo) && !argv.ReadOnly {
+ if repo.ReadOnly {
+ return
+ }
+ log.Info("readonly flag on repo is wrong", repo.GoPath)
return
}
start := fmt.Sprintf("%-40s %-8s %-20s %-20s %-20s", s["gopath"], s["rtype"], s["cver"], s["mver"], s["cver"])
if s["url"] != "" {
end += "(" + s["url"] + ") "
}
+ if repo.ReadOnly {
+ end += "(readonly) "
+ }
// end += fmt.Sprintf("(%s,%s,%s,%s) ", s["mname"], s["dname"], s["uname"], s["cname"])
log.Info(start, end)
}
@@ -76,7 +83,7 @@ func verify(repo *gitpb.Repo, s map[string]string) bool {
return false
}
// only verify the master branch name with read-only repos
- if me.forge.IsReadOnly(repo.GoPath) {
+ if me.forge.IsReadOnly(repo) {
s["mver"] = repo.GetMasterVersion()
return true
}
diff --git a/main.go b/main.go
index 7b0bef8..4b9b7c3 100644
--- a/main.go
+++ b/main.go
@@ -30,9 +30,10 @@ func main() {
list()
scan()
repomap()
- os.Exit(0)
if argv.RedoGoMod {
+ me.forge.RillRedoGoMod()
+ os.Exit(0)
repos := me.forge.Repos.SortByGoPath()
for repos.Scan() {
repo := repos.Next()
@@ -40,14 +41,15 @@ func main() {
log.Printf("%10s %-50s", "old?", repo.GetGoPath())
continue
}
- if me.forge.IsReadOnly(repo.GetGoPath()) {
- log.Printf("%10s %-50s", "readonly", repo.GetGoPath())
- continue
+ log.Printf("running on: %-50s", repo.GetGoPath())
+ if argv.Erase {
+ repo.EraseGoMod()
+ } else {
+ repo.RedoGoMod()
}
- repo.RedoGoMod()
}
- os.Exit(0)
}
+ os.Exit(0)
me.myGui = gui.New()
me.myGui.Default()
diff --git a/repomap.go b/repomap.go
index 877681f..8b23368 100644
--- a/repomap.go
+++ b/repomap.go
@@ -30,10 +30,13 @@ func repomap() {
comment = strings.Join(parts[2:], " ")
}
repo := me.forge.Repos.FindByGoPath(gopath)
+ if argv.Force && argv.Clone {
+ cmd := []string{"go-clone", "--recursive", gopath}
+ shell.RunRealtime(cmd)
+ continue
+ }
if repo == nil {
if argv.Clone {
- cmd := []string{"go-clone", "--recursive", gopath}
- shell.RunRealtime(cmd)
// me.forge.Clone(gopath)
} else {
log.Info(gopath, "need to clone")