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 // todo: make sure the master branch is in sync with remote master
continue continue
} }
hasLocal = true
if name == repo.GetUserBranchName() { if name == repo.GetUserBranchName() {
hasLocal = true
if err := doCleanUserBranch(repo, b); err != nil { if err := doCleanUserBranch(repo, b); err != nil {
log.Info("\tLOCAL BRANCH ERROR user")
return err return err
} }
log.Info("\tLOCAL BRANCH user")
continue continue
} }
if name == repo.GetDevelBranchName() { if name == repo.GetDevelBranchName() {
if err := doCleanDevelBranch(repo, b); err != nil { if err := doCleanDevelBranch(repo, b); err != nil {
log.Info("\tLOCAL BRANCH ERROR devel")
return err return err
} }
log.Info("\tLOCAL BRANCH devel")
continue continue
} }
log.Info("\tlocal branch name unknown:", name, b.Merge, b.Remote) 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{"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/remotes/origin", branch.Name)})
repo.RunVerbose([]string{"cat", filepath.Join(".git/refs/heads", 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 { } else {
log.Info("why is this local only branch a problem?", branch.Name) log.Info("why is this local only branch a problem?", branch.Name)
repo.RunVerbose([]string{"ls", "-l", ".git/refs/remotes/origin"}) 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) log.Info(cmd)
} }
if err := userToDevelRequiresGitPush(repo, branch.Name); err != nil { 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 return err
} }
log.Info("THIS USER BRANCH IS CLEAN TO DELETE", branch.Name) log.Info("THIS USER BRANCH IS CLEAN TO DELETE", branch.Name)
if argv.Clean.Force != nil { if argv.Clean.Force != nil {
cmd := []string{"git", "branch", "-D", branch.Name} cmd := []string{"git", "branch", "-D", branch.Name}
_, err := repo.RunVerbose(cmd) _, err := repo.RunVerbose(cmd)
log.Info(err)
return err return err
} }
} }

View File

@ -3,6 +3,8 @@ package main
// An app to submit patches for the 30 GO GUI repos // An app to submit patches for the 30 GO GUI repos
import ( import (
"os"
"go.wit.com/gui" "go.wit.com/gui"
"go.wit.com/lib/debugger" "go.wit.com/lib/debugger"
"go.wit.com/lib/gadgets" "go.wit.com/lib/gadgets"
@ -30,6 +32,16 @@ func doGui() {
me.mainWindow = gadgets.RawBasicWindow("Forge: (this doesn't work yet)") me.mainWindow = gadgets.RawBasicWindow("Forge: (this doesn't work yet)")
me.mainWindow.Make() me.mainWindow.Make()
me.mainWindow.Show() 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() me.mainbox = me.mainWindow.Box()
// disable the interface while everything is scanned // 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) r.box = r.win.Box().NewBox("bw vbox", false)
// me.reposwin.Draw() // me.reposwin.Draw()
r.win.Custom = func() { r.win.Custom = func() {
log.Warn("GOT HERE: main() gadgets.NewBasicWindow() close") log.Warn("Repo Window close. Do something 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()