From 4501e1e381c72182e73679ad8527a4d2eaf0742a Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sun, 25 Feb 2024 09:43:11 -0600 Subject: [PATCH] start adding git fetch --- globalBuildOptions.go | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-) diff --git a/globalBuildOptions.go b/globalBuildOptions.go index 244dc4e..5658b02 100644 --- a/globalBuildOptions.go +++ b/globalBuildOptions.go @@ -82,19 +82,19 @@ func globalBuildOptions(vbox *gui.Node) { me.autoCreateBranches = grid.NewCheckbox("create if missing").SetChecked(true) grid.NextRow() - grid.NewButton("default", func() { + grid.NewButton("git checkout default", func() { me.repos.View.ArgCheckoutUser() }) - grid.NewLabel("guimaster,master,main") // set the order of these in the config file + grid.NewLabel("master,main,etc.") // set the order of these in the config file grid.NextRow() - grid.NewButton("devel", func() { + grid.NewButton("git checkout devel", func() { me.repos.View.ArgCheckoutDevel() }) grid.NewLabel("guidevel,devel") grid.NextRow() - grid.NewButton("user", func() { + grid.NewButton("git checkout user", func() { me.repos.View.ArgCheckoutUser() }) grid.NewLabel(usr.Username) @@ -150,6 +150,30 @@ func globalBuildOptions(vbox *gui.Node) { me.newBranch.SetText(usr.Username) grid.NextRow() + me.setBranchB = grid.NewButton("git fetch master & devel", func() { + me.Disable() + defer me.Enable() + log.Warn("updating all master branches") + var count, failed int + for _, repo := range repolist.AllRepos() { + var err error + var out string + count += 1 + if err, out = repo.Status.FetchMaster(); err != nil { + log.Warn(repo.Name(), "fetch failed", err, out) + failed += 1 + } else { + log.Warn(repo.Name(), "fetch sent:", out) + } + if err, out = repo.Status.FetchDevel(); err != nil { + log.Warn(repo.Name(), "fetch failed", err, out) + failed += 1 + } else { + log.Warn(repo.Name(), "fetch sent:", out) + } + } + log.Warn("updated all master branches", count, "failed =", failed) + }) } // this code isn't ready yet