builds and runs ok
This commit is contained in:
parent
d84d7d4687
commit
6b2a61ff0e
1
Makefile
1
Makefile
|
@ -19,6 +19,7 @@ install: goimports vet
|
||||||
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
-ldflags "-X main.VERSION=${VERSION} -X main.BUILDTIME=${BUILDTIME} -X gui.GUIVERSION=${VERSION}"
|
||||||
|
|
||||||
goimports:
|
goimports:
|
||||||
|
reset
|
||||||
goimports -w *.go
|
goimports -w *.go
|
||||||
@# // to globally reset paths:
|
@# // to globally reset paths:
|
||||||
@# // gofmt -w -r '"go.wit.com/gui/gadgets" -> "go.wit.com/lib/gadgets"' *.go
|
@# // gofmt -w -r '"go.wit.com/gui/gadgets" -> "go.wit.com/lib/gadgets"' *.go
|
||||||
|
|
|
@ -24,7 +24,7 @@ func (args) doBashAuto() {
|
||||||
usr, _ := user.Current()
|
usr, _ := user.Current()
|
||||||
fmt.Println("user devel master " + usr.Username)
|
fmt.Println("user devel master " + usr.Username)
|
||||||
case "clean":
|
case "clean":
|
||||||
fmt.Println("")
|
fmt.Println("force")
|
||||||
case "commit":
|
case "commit":
|
||||||
fmt.Println("--all")
|
fmt.Println("--all")
|
||||||
case "config":
|
case "config":
|
||||||
|
|
|
@ -158,7 +158,6 @@ func rillCheckoutMaster(repo *gitpb.Repo) error {
|
||||||
func doAllCheckoutMaster() error {
|
func doAllCheckoutMaster() error {
|
||||||
me.forge.RillFuncError(rillCheckoutMaster)
|
me.forge.RillFuncError(rillCheckoutMaster)
|
||||||
count := me.forge.RillReload()
|
count := me.forge.RillReload()
|
||||||
log.Info("CHECKOUT MASTER COUNT", count)
|
|
||||||
if count != 0 {
|
if count != 0 {
|
||||||
me.forge.ConfigSave()
|
me.forge.ConfigSave()
|
||||||
}
|
}
|
||||||
|
|
74
doClean.go
74
doClean.go
|
@ -2,6 +2,9 @@ package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
|
"path/filepath"
|
||||||
|
"slices"
|
||||||
|
|
||||||
"go.wit.com/lib/protobuf/gitpb"
|
"go.wit.com/lib/protobuf/gitpb"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
|
@ -87,6 +90,75 @@ func doCleanUserBranch(repo *gitpb.Repo, branch *gitpb.GitBranch) error {
|
||||||
if branch.Name != repo.GetUserBranchName() {
|
if branch.Name != repo.GetUserBranchName() {
|
||||||
return fmt.Errorf("repo %s was not user branch %s", repo.GetGoPath(), branch.Name)
|
return fmt.Errorf("repo %s was not user branch %s", repo.GetGoPath(), branch.Name)
|
||||||
}
|
}
|
||||||
log.Printf("\tDo something %s on branch name:%s merge:%s remote:%s\n", repo.GetGoPath(), branch.Name, branch.Merge, branch.Remote)
|
/*
|
||||||
|
if bran == repo.GetUserBranchName() {
|
||||||
|
log.Info("The user branch also has a remote branch", repo.CurrentTag.Refname)
|
||||||
|
log.Info("TODO: verify the remote branch is out of date", repo.CurrentTag.Refname)
|
||||||
|
log.Info("TODO: delete the remote branch", repo.CurrentTag.Refname)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
if !repo.Exists(filepath.Join(".git/refs/heads", branch.Name)) {
|
||||||
|
err := fmt.Errorf("BAD FORGE LOGIC. DELETE REPO %s", repo.GetGoPath())
|
||||||
|
log.Warn(err)
|
||||||
|
me.forge.Repos.Repos = slices.DeleteFunc(me.forge.Repos.Repos, func(r *gitpb.Repo) bool {
|
||||||
|
if repo.GetGoPath() == r.GetGoPath() {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
})
|
||||||
|
|
||||||
|
// me.forge.Repos.Delete(repo)
|
||||||
|
me.forge.ConfigSave()
|
||||||
|
os.Exit(0)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if repo.Exists(filepath.Join(".git/refs/remotes/origin", branch.Name)) {
|
||||||
|
log.Info("why is this non-localonly branch a problem?", branch.Name)
|
||||||
|
repo.RunVerbose([]string{"ls", "-l", ".git/refs/remotes/origin"})
|
||||||
|
repo.RunVerbose([]string{"cat", filepath.Join(".git/refs/remotes/origin", branch.Name)})
|
||||||
|
repo.RunVerbose([]string{"cat", filepath.Join(".git/refs/heads", branch.Name)})
|
||||||
|
} else {
|
||||||
|
log.Info("why is this local only branch a problem?", branch.Name)
|
||||||
|
repo.RunVerbose([]string{"ls", "-l", ".git/refs/remotes/origin"})
|
||||||
|
r, err := repo.RunVerbose([]string{"cat", filepath.Join(".git/refs/heads", branch.Name)})
|
||||||
|
if err == nil {
|
||||||
|
cmd := []string{"git", "show", "-s", "--format=\"%H %ae %as %s\"", r.Stdout[0]}
|
||||||
|
repo.RunVerbose(cmd)
|
||||||
|
log.Info(cmd)
|
||||||
|
}
|
||||||
|
if err := userToDevelRequiresGitPush(repo, branch.Name); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
log.Info("THIS USER BRANCH IS CLEAN TO DELETE", branch.Name)
|
||||||
|
if argv.Clean.Force != nil {
|
||||||
|
cmd := []string{"git", "branch", "-D", branch.Name}
|
||||||
|
_, err := repo.RunVerbose(cmd)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// return fmt.Errorf("%s repo.CurrentTag is not local: %s. Don't proceed yet", repo.GetGoPath(), repo.CurrentTag.Refname)
|
||||||
|
log.Printf("Do something %s on branch name:%s merge:%s remote:%s\n", repo.GetGoPath(), branch.Name, branch.Merge, branch.Remote)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func userToDevelRequiresGitPush(repo *gitpb.Repo, branchName string) error {
|
||||||
|
devel := repo.GetDevelBranchName()
|
||||||
|
b1 := countDiffObjects(repo, branchName, "origin/"+devel)
|
||||||
|
b2 := countDiffObjects(repo, "origin/"+devel, branchName)
|
||||||
|
log.Info("user vs devel count", b1, b2)
|
||||||
|
if b1 == 0 && b2 == 0 {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
if b1 != 0 {
|
||||||
|
log.Info("user vs devel count b1 != 0, b2 ==", b1, b2)
|
||||||
|
log.Info("THIS MEANS THE LOCAL BRANCH NEEDS GIT PUSH TO ORIGIN BRANCH ==", b1)
|
||||||
|
// if argv.Examine.Fix != nil {
|
||||||
|
// return gitPushStrict(repo, branchName)
|
||||||
|
// }
|
||||||
|
return fmt.Errorf("user branch not clean to delete %d %d", b1, b2)
|
||||||
|
}
|
||||||
|
return fmt.Errorf("user branch not clean to delete. maybe it is? devel might be ahead of user branch. %d %d", b1, b2)
|
||||||
|
}
|
||||||
|
|
|
@ -56,6 +56,12 @@ func makeRepoView() *repoWindow {
|
||||||
r.win.Custom = func() {
|
r.win.Custom = func() {
|
||||||
log.Warn("GOT HERE: main() gadgets.NewBasicWindow() close")
|
log.Warn("GOT HERE: main() gadgets.NewBasicWindow() close")
|
||||||
log.Warn("Should I do something special here?")
|
log.Warn("Should I do something special here?")
|
||||||
|
count := me.forge.RillReload()
|
||||||
|
log.Info("Repo Reload count =", count)
|
||||||
|
if count != 0 {
|
||||||
|
me.forge.ConfigSave()
|
||||||
|
}
|
||||||
|
os.Exit(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
r.topbox = r.repoMenu()
|
r.topbox = r.repoMenu()
|
||||||
|
|
Loading…
Reference in New Issue