git branch handling continues

This commit is contained in:
Jeff Carr 2025-01-19 02:56:48 -06:00
parent 6b2a61ff0e
commit 69eee08045
3 changed files with 33 additions and 9 deletions

View File

@ -56,17 +56,21 @@ func doCleanRepo(repo *gitpb.Repo) error {
// todo: make sure the master branch is in sync with remote master
continue
}
hasLocal = true
if name == repo.GetUserBranchName() {
hasLocal = true
if err := doCleanUserBranch(repo, b); err != nil {
log.Info("\tLOCAL BRANCH ERROR user")
return err
}
log.Info("\tLOCAL BRANCH user")
continue
}
if name == repo.GetDevelBranchName() {
if err := doCleanDevelBranch(repo, b); err != nil {
log.Info("\tLOCAL BRANCH ERROR devel")
return err
}
log.Info("\tLOCAL BRANCH devel")
continue
}
log.Info("\tlocal branch name unknown:", name, b.Merge, b.Remote)
@ -120,6 +124,18 @@ func doCleanUserBranch(repo *gitpb.Repo, branch *gitpb.GitBranch) error {
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)})
if err := userToDevelRequiresGitPush(repo, branch.Name); err != nil {
log.Info(err)
log.Info("THIS USER BRANCH MUST BE PUSHED TO DEVEL", branch.Name)
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)
log.Info(err)
return err
}
} else {
log.Info("why is this local only branch a problem?", branch.Name)
repo.RunVerbose([]string{"ls", "-l", ".git/refs/remotes/origin"})
@ -130,12 +146,15 @@ func doCleanUserBranch(repo *gitpb.Repo, branch *gitpb.GitBranch) error {
log.Info(cmd)
}
if err := userToDevelRequiresGitPush(repo, branch.Name); err != nil {
log.Info(err)
log.Info("THIS USER BRANCH MUST BE PUSHED TO DEVEL", branch.Name)
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)
log.Info(err)
return err
}
}

View File

@ -3,6 +3,8 @@ package main
// An app to submit patches for the 30 GO GUI repos
import (
"os"
"go.wit.com/gui"
"go.wit.com/lib/debugger"
"go.wit.com/lib/gadgets"
@ -30,6 +32,16 @@ func doGui() {
me.mainWindow = gadgets.RawBasicWindow("Forge: (this doesn't work yet)")
me.mainWindow.Make()
me.mainWindow.Show()
me.mainWindow.Custom = func() {
log.Warn("MAIN WINDOW CLOSE")
count := me.forge.RillReload()
log.Info("Repo Reload count =", count)
if count != 0 {
me.forge.ConfigSave()
}
os.Exit(0)
}
me.mainbox = me.mainWindow.Box()
// disable the interface while everything is scanned

View File

@ -54,14 +54,7 @@ func makeRepoView() *repoWindow {
r.box = r.win.Box().NewBox("bw vbox", false)
// me.reposwin.Draw()
r.win.Custom = func() {
log.Warn("GOT HERE: main() gadgets.NewBasicWindow() close")
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)
log.Warn("Repo Window close. Do something here?")
}
r.topbox = r.repoMenu()