lots of cleanups
This commit is contained in:
parent
1d124c7dbf
commit
5d232293a0
22
common.go
22
common.go
|
@ -33,10 +33,10 @@ func (r *RepoList) FindByName(name string) *RepoRow {
|
||||||
loop := r.ReposSortByName()
|
loop := r.ReposSortByName()
|
||||||
for loop.Scan() {
|
for loop.Scan() {
|
||||||
repo := loop.Repo()
|
repo := loop.Repo()
|
||||||
if repo.pb.GoPath == name {
|
if repo.pb.GetGoPath() == name {
|
||||||
return repo
|
return repo
|
||||||
}
|
}
|
||||||
base := filepath.Base(repo.GoPath())
|
base := filepath.Base(repo.GetGoPath())
|
||||||
if base == name {
|
if base == name {
|
||||||
return repo
|
return repo
|
||||||
}
|
}
|
||||||
|
@ -84,11 +84,11 @@ func (r *RepoRow) Scan() int {
|
||||||
// returns a name for human consuption only
|
// returns a name for human consuption only
|
||||||
// todo: implement nicknames
|
// todo: implement nicknames
|
||||||
func (rs *RepoRow) Name() string {
|
func (rs *RepoRow) Name() string {
|
||||||
return rs.pb.GoPath
|
return rs.pb.GetGoPath()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *RepoRow) GoPath() string {
|
func (r *RepoRow) GetGoPath() string {
|
||||||
return r.pb.GoPath
|
return r.pb.GetGoPath()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *RepoRow) CheckDirty() bool {
|
func (r *RepoRow) CheckDirty() bool {
|
||||||
|
@ -100,7 +100,7 @@ func (r *RepoRow) IsDirty() bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *RepoRow) RepoType() string {
|
func (r *RepoRow) RepoType() string {
|
||||||
return r.pb.RepoType()
|
return r.pb.GetRepoType()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *RepoRow) ReadOnly() bool {
|
func (r *RepoRow) ReadOnly() bool {
|
||||||
|
@ -188,17 +188,17 @@ func (rl *RepoList) MakeGoWork() error {
|
||||||
|
|
||||||
for _, k := range keys {
|
for _, k := range keys {
|
||||||
repo := rl.allrepos[k]
|
repo := rl.allrepos[k]
|
||||||
if repo.pb.GoPath == "" {
|
if repo.pb.GetGoPath() == "" {
|
||||||
// skip repos that aren't go
|
// skip repos that aren't go
|
||||||
// todo: handle non-flat repos?
|
// todo: handle non-flat repos?
|
||||||
log.Info("SKIPPED REPO", repo.pb.GoPath)
|
log.Info("SKIPPED REPO", repo.pb.GetGoPath())
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if repo.pb.Exists("go.mod") {
|
if repo.pb.Exists("go.mod") {
|
||||||
fmt.Fprintln(f, "\t"+repo.pb.GoPath)
|
fmt.Fprintln(f, "\t"+repo.pb.GetGoPath())
|
||||||
log.Info("ADDING REPO", goSrcDir, repo.pb.GoPath)
|
log.Info("ADDING REPO", goSrcDir, repo.pb.GetGoPath())
|
||||||
} else {
|
} else {
|
||||||
log.Log(REPO, "missing go.mod for", repo.pb.GoPath)
|
log.Log(REPO, "missing go.mod for", repo.pb.GetGoPath())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fmt.Fprintln(f, ")")
|
fmt.Fprintln(f, ")")
|
||||||
|
|
|
@ -30,7 +30,7 @@ func (repo *RepoRow) GetPatches(oldname string, newname string) (int, []*Patch)
|
||||||
log.Info("Run:", gitcmd)
|
log.Info("Run:", gitcmd)
|
||||||
r := repo.Status.Run(gitcmd)
|
r := repo.Status.Run(gitcmd)
|
||||||
if r.Error != nil {
|
if r.Error != nil {
|
||||||
log.Info("git failed ", repo.GoPath(), "err =", r.Error)
|
log.Info("git failed ", repo.GetGoPath(), "err =", r.Error)
|
||||||
return 0, nil
|
return 0, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ func (r *RepoList) MakePatchset(setdir string) bool {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
repodir := filepath.Join(setdir, repo.GoPath())
|
repodir := filepath.Join(setdir, repo.GetGoPath())
|
||||||
shell.Mkdir(repodir)
|
shell.Mkdir(repodir)
|
||||||
// git format-patch branch1..branch2
|
// git format-patch branch1..branch2
|
||||||
gitcmd := []string{"git", "format-patch", "-o", repodir, develn + ".." + usern}
|
gitcmd := []string{"git", "format-patch", "-o", repodir, develn + ".." + usern}
|
||||||
|
@ -105,10 +105,10 @@ func (r *RepoList) MakePatchset(setdir string) bool {
|
||||||
r := repo.Status.Run(gitcmd)
|
r := repo.Status.Run(gitcmd)
|
||||||
log.Info("output =", r.Stdout)
|
log.Info("output =", r.Stdout)
|
||||||
if r.Error == nil {
|
if r.Error == nil {
|
||||||
log.Info("patches made okay for:", repo.GoPath())
|
log.Info("patches made okay for:", repo.GetGoPath())
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
log.Info("patches failed for:", repo.GoPath())
|
log.Info("patches failed for:", repo.GetGoPath())
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
return true
|
return true
|
||||||
|
|
8
init.go
8
init.go
|
@ -21,10 +21,10 @@ func Init(f *forgepb.Forge, g *gui.Node) *RepoList {
|
||||||
|
|
||||||
me.viewName = "autotypist"
|
me.viewName = "autotypist"
|
||||||
|
|
||||||
repos := me.forge.Repos.SortByGoPath()
|
repos := me.forge.Repos.SortByFullPath()
|
||||||
for repos.Scan() {
|
for repos.Scan() {
|
||||||
repo := repos.Next()
|
repo := repos.Next()
|
||||||
if me.forge.Config.IsReadOnly(repo.GoPath) {
|
if me.forge.Config.IsReadOnly(repo.GetGoPath()) {
|
||||||
log.Info("repo scan readonly directory:", repo.FullPath)
|
log.Info("repo scan readonly directory:", repo.FullPath)
|
||||||
} else {
|
} else {
|
||||||
log.Info("repo scan writable directory:", repo.FullPath)
|
log.Info("repo scan writable directory:", repo.FullPath)
|
||||||
|
@ -47,10 +47,10 @@ func InitBox(f *forgepb.Forge, newbox *gui.Node) *RepoList {
|
||||||
|
|
||||||
me.viewName = "autotypist"
|
me.viewName = "autotypist"
|
||||||
|
|
||||||
repos := me.forge.Repos.SortByGoPath()
|
repos := me.forge.Repos.SortByFullPath()
|
||||||
for repos.Scan() {
|
for repos.Scan() {
|
||||||
repo := repos.Next()
|
repo := repos.Next()
|
||||||
if me.forge.Config.IsReadOnly(repo.GoPath) {
|
if me.forge.Config.IsReadOnly(repo.GetGoPath()) {
|
||||||
log.Info("repo scan readonly directory:", repo.FullPath)
|
log.Info("repo scan readonly directory:", repo.FullPath)
|
||||||
} else {
|
} else {
|
||||||
log.Info("repo scan writable directory:", repo.FullPath)
|
log.Info("repo scan writable directory:", repo.FullPath)
|
||||||
|
|
|
@ -82,10 +82,10 @@ func (r *RepoList) AddRepo(pb *gitpb.Repo) (*RepoRow, error) {
|
||||||
newRepo.pb = pb
|
newRepo.pb = pb
|
||||||
newRepo.Status.InitOk = false
|
newRepo.Status.InitOk = false
|
||||||
|
|
||||||
newRepo.pLabel = r.reposgrid.NewLabel(pb.GoPath).SetProgName("path")
|
newRepo.pLabel = r.reposgrid.NewLabel(pb.GetGoPath()).SetProgName("path")
|
||||||
newRepo.hidden = false
|
newRepo.hidden = false
|
||||||
|
|
||||||
r.allrepos[pb.GoPath] = newRepo
|
r.allrepos[pb.GetGoPath()] = newRepo
|
||||||
// newRepo.NewScan()
|
// newRepo.NewScan()
|
||||||
|
|
||||||
newRepo.lastTag = r.reposgrid.NewLabel("")
|
newRepo.lastTag = r.reposgrid.NewLabel("")
|
||||||
|
|
3
scan.go
3
scan.go
|
@ -71,6 +71,9 @@ func (r *RepoRow) NewScan() int {
|
||||||
r.currentName.SetLabel(r.Status.GetCurrentBranchName())
|
r.currentName.SetLabel(r.Status.GetCurrentBranchName())
|
||||||
r.currentVersion.SetLabel(r.Status.GetCurrentBranchVersion())
|
r.currentVersion.SetLabel(r.Status.GetCurrentBranchVersion())
|
||||||
|
|
||||||
|
if r.State() == "merge to main" {
|
||||||
|
r.Hide()
|
||||||
|
}
|
||||||
if r.Status.GitState() == "PERFECT" {
|
if r.Status.GitState() == "PERFECT" {
|
||||||
r.Hide()
|
r.Hide()
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -78,7 +78,7 @@ func (r *RepoList) UnmergedRepos() *RepoIterator {
|
||||||
type ByName []*RepoRow
|
type ByName []*RepoRow
|
||||||
|
|
||||||
func (a ByName) Len() int { return len(a) }
|
func (a ByName) Len() int { return len(a) }
|
||||||
func (a ByName) Less(i, j int) bool { return a[i].GoPath() < a[j].GoPath() }
|
func (a ByName) Less(i, j int) bool { return a[i].GetGoPath() < a[j].GetGoPath() }
|
||||||
func (a ByName) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
func (a ByName) Swap(i, j int) { a[i], a[j] = a[j], a[i] }
|
||||||
|
|
||||||
// SelectRepoPointers safely returns a slice of pointers to Repo records.
|
// SelectRepoPointers safely returns a slice of pointers to Repo records.
|
||||||
|
|
Loading…
Reference in New Issue