From 339c88ccbd9975f9d38564097998f9a1dd58fee2 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Sun, 1 Dec 2024 12:53:08 -0600 Subject: [PATCH] save Published() go deps --- build.go | 5 +++++ repoNew.go | 41 +++++++++++++++++++++++++++++++++++++++++ 2 files changed, 46 insertions(+) diff --git a/build.go b/build.go index 7e046e5..f958e80 100644 --- a/build.go +++ b/build.go @@ -48,6 +48,11 @@ func (f *Forge) Build(repo *gitpb.Repo, userFlags []string) error { t := loop1.Next() log.Info("Build() dep:", t.GetGoPath(), t.GetVersion()) } + loop2 := repo.Published.SortByGoPath() + for loop2.Scan() { + t := loop2.Next() + log.Info("Build() pub:", t.GetGoPath(), t.GetVersion()) + } log.Info("Build() dep len:", repo.GoDeps.Len()) os.Exit(-1) diff --git a/repoNew.go b/repoNew.go index 605c74b..ad58373 100644 --- a/repoNew.go +++ b/repoNew.go @@ -45,3 +45,44 @@ func (f *Forge) NewGoPath(gopath string) (*gitpb.Repo, error) { // return newr, err } + +func (f *Forge) VerifyBranchNames(newr *gitpb.Repo) { + // log.Info("init worked for", newr.GoPath) + + if newr.GetMasterBranchName() == "" { + // try to guess what the 'master' branch is + if newr.IsBranch("guimaster") { + newr.SetMasterBranchName("guimaster") + } else if newr.IsBranch("master") { + newr.SetMasterBranchName("master") + } else if newr.IsBranch("main") { + newr.SetMasterBranchName("main") + } else { + newr.SetMasterBranchName("masterFIXME") + } + } + + if f.IsReadOnly(newr.GoPath) { + return + } + + if newr.GetDevelBranchName() == "" { + if newr.IsBranch("guidevel") { + newr.SetDevelBranchName("guidevel") + } else if newr.IsBranch("devel") { + newr.SetDevelBranchName("devel") + } else { + newr.SetDevelBranchName("develFIXME") + } + } + + if newr.GetUserBranchName() == "" { + usr, _ := user.Current() + uname := usr.Username + if newr.IsBranch(uname) { + newr.SetUserBranchName(uname) + } else { + newr.SetUserBranchName(uname + "FIXME") + } + } +}