summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile1
-rw-r--r--argv.go1
-rw-r--r--list.go19
-rw-r--r--submitPatches.go85
4 files changed, 62 insertions, 44 deletions
diff --git a/Makefile b/Makefile
index a404080..0b8ffdf 100644
--- a/Makefile
+++ b/Makefile
@@ -37,6 +37,7 @@ redomod:
GO111MODULE= go mod tidy
list: build
+ reset
./forge --list
list-config: build
diff --git a/argv.go b/argv.go
index 3c19f8b..81668c1 100644
--- a/argv.go
+++ b/argv.go
@@ -9,6 +9,7 @@ var argv args
type args struct {
List bool `arg:"--list" help:"list found repos"`
ListConf bool `arg:"--list-conf" help:"list your .config/forge/ configuration"`
+ ReadOnly bool `arg:"--read-only" help:"include read-only repos"`
GetMine bool `arg:"--mine" help:"download private and writeable repos"`
GetFav bool `arg:"--favorites" help:"download repos marked as favorites"`
Pull bool `arg:"--git-pull" help:"run 'git pull' on all your repos"`
diff --git a/list.go b/list.go
index 3cfe9c3..646db57 100644
--- a/list.go
+++ b/list.go
@@ -1,6 +1,7 @@
package main
import (
+ "fmt"
"os"
"go.wit.com/log"
@@ -16,11 +17,25 @@ func list() {
repos := me.forge.Repos.SortByGoPath()
for repos.Scan() {
repo := repos.Next()
+ var rtype string
if !repo.IsValid() {
- log.Printf("%10s %-50s", "old?", repo.GetGoPath())
+ rtype = "rm?"
continue
+ } else {
+ rtype = repo.RepoType()
}
- log.Printf("%10s %-50s", repo.RepoType(), repo.GetGoPath())
+ if me.forge.IsReadOnly(repo.GetGoPath()) {
+ continue
+ }
+ var end string
+ if repo.CheckDirty() {
+ end += "(dirty) "
+ }
+ mver := repo.GetMasterVersion()
+ dver := repo.GetDevelVersion()
+ uver := repo.GetUserVersion()
+ s := fmt.Sprintf("%-50s %-8s %-10s %-10s %-10s", repo.GetGoPath(), rtype, mver, dver, uver)
+ log.Info(s, end)
}
os.Exit(0)
}
diff --git a/submitPatches.go b/submitPatches.go
index f2e7842..30ba9b3 100644
--- a/submitPatches.go
+++ b/submitPatches.go
@@ -6,7 +6,6 @@ import (
"go.wit.com/gui"
"go.wit.com/lib/gadgets"
- "go.wit.com/lib/gui/gowit"
"go.wit.com/lib/gui/repolist"
"go.wit.com/lib/gui/shell"
"go.wit.com/log"
@@ -57,10 +56,11 @@ func submitPatchesBox(box *gui.Node) *patchSummary {
s.grid.NewButton("Update Patch Counts", func() {
var repocount, patchcount int
- loop := me.repos.View.UnmergedRepos()
+ // broken after move to forge protobuf
+ loop := me.forge.Repos.SortByGoPath()
for loop.Scan() {
- repo := loop.Repo()
- if repo.ReadOnly() {
+ repo := loop.Next()
+ if repo.GetReadOnly() {
continue
}
i, _ := repo.GetMasterPatches()
@@ -74,10 +74,11 @@ func submitPatchesBox(box *gui.Node) *patchSummary {
repocount = 0
patchcount = 0
- loop = me.repos.View.UnmergedRepos()
+ // broken after move to forge protobuf
+ loop = me.forge.Repos.SortByGoPath()
for loop.Scan() {
- repo := loop.Repo()
- if repo.ReadOnly() {
+ repo := loop.Next()
+ if repo.GetReadOnly() {
continue
}
i, _ := repo.GetUserPatches()
@@ -175,31 +176,33 @@ func submitPatchesBox(box *gui.Node) *patchSummary {
s.submitB.Disable()
s.grid.NextRow()
- // map a path to gitea
- s.unknownOL = gadgets.NewBasicEntry(s.grid, "Unknown Repo:")
- s.unknownSubmitB = s.grid.NewButton("map new repo path", func() {
- log.Info("Submit repo:", s.unknownOL.String())
- repo := me.repos.View.FindRepo(s.unknownOL.String())
- if repo == nil {
- log.Info("could not find repo:", s.unknownOL.String(), "in ~/go/src")
- return
- }
+ /*
+ // map a path to gitea
+ s.unknownOL = gadgets.NewBasicEntry(s.grid, "Unknown Repo:")
+ s.unknownSubmitB = s.grid.NewButton("map new repo path", func() {
+ log.Info("Submit repo:", s.unknownOL.String())
+ repo := me.repos.View.FindRepo(s.unknownOL.String())
+ if repo == nil {
+ log.Info("could not find repo:", s.unknownOL.String(), "in ~/go/src")
+ return
+ }
- localurl := repo.Status.GitURL()
- log.Info("found repo:", repo.GoPath(), "with giturl", localurl)
- if localurl == "" {
- log.Info("local repo check failed. repo")
- } else {
- log.Info("local repo has", localurl)
- // check if go.wit.com works, if not, add it
- // attempts to register the unknown repo
- if gowit.Register(repo.GoPath(), localurl) {
- // todo: check if this works
- // s.unknownOL.Hide()
- // s.unknownSubmitB.Hide()
+ localurl := repo.GetURL()
+ log.Info("found repo:", repo.GoPath(), "with giturl", localurl)
+ if localurl == "" {
+ log.Info("local repo check failed. repo")
+ } else {
+ log.Info("local repo has", localurl)
+ // check if go.wit.com works, if not, add it
+ // attempts to register the unknown repo
+ if gowit.Register(repo.GoPath(), localurl) {
+ // todo: check if this works
+ // s.unknownOL.Hide()
+ // s.unknownSubmitB.Hide()
+ }
}
- }
- })
+ })
+ */
s.unknownOL.Disable()
s.unknownSubmitB.Disable()
s.grid.NextRow()
@@ -212,31 +215,29 @@ func (s *patchSummary) Update() {
var total, totalgo, dirty, readonly int
var userT, develT, masterT int
// var userP, develP, masterP int
- loop := me.repos.View.UnmergedRepos()
+ // broken after move to forge protobuf
+ loop := me.forge.Repos.SortByGoPath()
for loop.Scan() {
- repo := loop.Repo()
+ repo := loop.Next()
total += 1
- if repo.Status.IsDirty() {
+ if repo.IsDirty() {
dirty += 1
}
- if repo.Status.IsGoLang() {
- totalgo += 1
- }
- if repo.Status.ReadOnly() {
+ if repo.GetReadOnly() {
readonly += 1
// don't count these in any further stats
continue
}
// compute which GUI repos are out of sync with master
- userV := repo.Status.GetUserVersion()
- develV := repo.Status.GetDevelVersion()
- masterV := repo.Status.GetMasterVersion()
- lastV := repo.Status.GetLastTagVersion()
+ userV := repo.GetUserVersion()
+ develV := repo.GetDevelVersion()
+ masterV := repo.GetMasterVersion()
+ lastV := repo.GetLastTagVersion()
if userV != develV {
userT += 1
}
if develV != masterV {
- log.Info("develV != masterV", develV, masterV, repo.GoPath())
+ log.Info("develV != masterV", develV, masterV, repo.GetGoPath())
develT += 1
}
if masterV != lastV {