summaryrefslogtreecommitdiff
path: root/repoNew.go
diff options
context:
space:
mode:
Diffstat (limited to 'repoNew.go')
-rw-r--r--repoNew.go26
1 files changed, 21 insertions, 5 deletions
diff --git a/repoNew.go b/repoNew.go
index 69a2338..0fa35d8 100644
--- a/repoNew.go
+++ b/repoNew.go
@@ -14,11 +14,15 @@ func (f *Forge) NewGoRepo(gopath string, url string) (*gitpb.Repo, error) {
fullpath := filepath.Join(f.GetGoSrc(), gopath)
repo, err := f.Repos.NewGoRepo(fullpath, gopath)
if err != nil {
+ log.Info("WARNING. NEW FAILED", fullpath)
return nil, err
}
repo.URL = url
f.VerifyBranchNames(repo)
- repo.Reload()
+ if f.Config.IsReadOnly(repo.GetGoPath()) {
+ repo.ReadOnly = true
+ }
+ repo.InitVersions()
return repo, nil
}
@@ -43,15 +47,20 @@ func (f *Forge) ValidGoVersion(ver string) (bool, error) {
func (f *Forge) VerifyBranchNames(newr *gitpb.Repo) {
// log.Info("init worked for", newr.GoPath)
+ var mname string
if newr.GetMasterBranchName() == "" {
// try to guess what the 'master' branch is
if newr.IsBranch("guimaster") {
+ mname = "guimaster"
newr.SetMasterBranchName("guimaster")
} else if newr.IsBranch("master") {
+ mname = "master"
newr.SetMasterBranchName("master")
} else if newr.IsBranch("main") {
+ mname = "main"
newr.SetMasterBranchName("main")
} else {
+ mname = "master"
// todo, figure out the name from git
newr.SetMasterBranchName("master")
if newr.CheckoutMaster() {
@@ -61,10 +70,7 @@ func (f *Forge) VerifyBranchNames(newr *gitpb.Repo) {
}
}
}
-
- if f.Config.IsReadOnly(newr.GoPath) {
- return
- }
+ log.Info("forge.NewRepo() SET MASTER TO", mname)
if newr.GetDevelBranchName() == "" {
if newr.IsBranch("guidevel") {
@@ -131,3 +137,13 @@ func (f *Forge) AddFullPath(fulldir string) *gitpb.Repo {
log.Info("don't know how to add full paths yet", fulldir)
return nil
}
+
+func (f *Forge) FindByGoPath(gopath string) *gitpb.Repo {
+ fullpath := filepath.Join(f.GetGoSrc(), gopath)
+ return f.Repos.FindByFullPath(fullpath)
+}
+
+func (f *Forge) DeleteByGoPath(gopath string) bool {
+ fullpath := filepath.Join(f.GetGoSrc(), gopath)
+ return f.Repos.DeleteByFullPath(fullpath)
+}