start adding git fetch

This commit is contained in:
Jeff Carr 2024-02-25 09:43:11 -06:00
parent 01f93fe846
commit 4501e1e381
1 changed files with 28 additions and 4 deletions

View File

@ -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