actually use the damn information I already put in a protobuf
This commit is contained in:
parent
312c4742b6
commit
010791e828
|
@ -162,66 +162,6 @@ func (repo *Repo) gitVersionByName(name string) (string, error) {
|
|||
return strings.TrimSpace(output), nil
|
||||
}
|
||||
|
||||
// find a branch name
|
||||
// will find "master" or "devel"
|
||||
// will also find "v0.1.1"
|
||||
// or will find "patches-from-foo"
|
||||
// will return *any* match on any git branch because it doesn't
|
||||
// matter much here yet
|
||||
// eventually this will be worked out by forge in some future code that hasn't been made yet
|
||||
func (repo *Repo) IsBranch(findname string) bool {
|
||||
loop := repo.Tags.All()
|
||||
for loop.Scan() {
|
||||
t := loop.Next()
|
||||
// log.Info("LocalTagExists() tag:", t.Refname)
|
||||
|
||||
tagname := t.Refname
|
||||
if strings.HasPrefix(tagname, "refs/remotes") {
|
||||
continue
|
||||
}
|
||||
path, filename := filepath.Split(tagname)
|
||||
log.Log(INFO, "gitpb.IsBranch() tag:", path, filename, "from", repo.GetGoPath())
|
||||
if filename == findname {
|
||||
log.Log(INFO, "gitpb.IsBranch() found tag:", path, filename, "from", repo.GetGoPath())
|
||||
return true
|
||||
}
|
||||
}
|
||||
log.Log(INFO, "did not find tag:", findname, "in", repo.GetGoPath())
|
||||
return false
|
||||
}
|
||||
|
||||
// todo: redo this and above. both are messed up. ignore for now until things are stable
|
||||
func (repo *Repo) IsLocalBranch(findname string) bool {
|
||||
loop := repo.Tags.All()
|
||||
for loop.Scan() {
|
||||
t := loop.Next()
|
||||
// log.Info("LocalTagExists() tag:", t.Refname)
|
||||
|
||||
tagname := t.Refname
|
||||
if strings.HasPrefix(tagname, "refs/heads") {
|
||||
continue
|
||||
}
|
||||
path, filename := filepath.Split(tagname)
|
||||
log.Log(INFO, "gitpb.IsBranch() tag:", path, filename, "from", repo.GetGoPath())
|
||||
if filename == findname {
|
||||
log.Log(INFO, "gitpb.IsBranch() found tag:", path, filename, "from", repo.GetGoPath())
|
||||
return true
|
||||
}
|
||||
}
|
||||
log.Log(INFO, "did not find tag:", findname, "in", repo.GetGoPath())
|
||||
return false
|
||||
}
|
||||
|
||||
// todo: redo this and above. both are messed up. ignore for now until things are stable
|
||||
func (repo *Repo) IsDevelRemote() bool {
|
||||
bname := repo.GetDevelBranchName()
|
||||
rpath := filepath.Join("refs/remotes/origin", bname)
|
||||
if repo.Exists(rpath) {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func trimNonNumericFromStart(s string) string {
|
||||
for i, r := range s {
|
||||
if unicode.IsDigit(r) {
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
package gitpb
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
func (repo *Repo) DevelHash() string {
|
||||
brname := repo.GetDevelBranchName()
|
||||
refname := "refs/heads/" + brname
|
||||
|
@ -13,3 +20,68 @@ func (repo *Repo) DevelHash() string {
|
|||
}
|
||||
return ""
|
||||
}
|
||||
|
||||
func (repo *Repo) IsDevelRemote() bool {
|
||||
if repo.Tags == nil {
|
||||
return false
|
||||
}
|
||||
|
||||
devname := repo.GetDevelBranchName()
|
||||
refname := "refs/remotes/origin/" + devname
|
||||
ref := repo.Tags.FindByRefname(refname)
|
||||
if ref == nil {
|
||||
log.Info("did not found refname!!!!!!!!", refname)
|
||||
return false
|
||||
}
|
||||
log.Info("found refname!!!!!!!!")
|
||||
return true
|
||||
}
|
||||
|
||||
// find a branch namm
|
||||
// will find "master" or "devel"
|
||||
// will also find "v0.1.1"
|
||||
// or will find "patches-from-foo"
|
||||
// will return *any* match on any git branch because it doesn't
|
||||
// matter much here yet
|
||||
// eventually this will be worked out by forge in some future code that hasn't been made yet
|
||||
func (repo *Repo) IsBranch(findname string) bool {
|
||||
loop := repo.Tags.All()
|
||||
for loop.Scan() {
|
||||
t := loop.Next()
|
||||
// log.Info("LocalTagExists() tag:", t.Refname)
|
||||
|
||||
tagname := t.Refname
|
||||
if strings.HasPrefix(tagname, "refs/remotes") {
|
||||
continue
|
||||
}
|
||||
path, filename := filepath.Split(tagname)
|
||||
log.Log(INFO, "gitpb.IsBranch() tag:", path, filename, "from", repo.GetGoPath())
|
||||
if filename == findname {
|
||||
log.Log(INFO, "gitpb.IsBranch() found tag:", path, filename, "from", repo.GetGoPath())
|
||||
return true
|
||||
}
|
||||
}
|
||||
log.Log(INFO, "did not find tag:", findname, "in", repo.GetGoPath())
|
||||
return false
|
||||
}
|
||||
|
||||
func (repo *Repo) IsLocalBranch(findname string) bool {
|
||||
loop := repo.Tags.All()
|
||||
for loop.Scan() {
|
||||
t := loop.Next()
|
||||
// log.Info("LocalTagExists() tag:", t.Refname)
|
||||
|
||||
tagname := t.Refname
|
||||
if strings.HasPrefix(tagname, "refs/heads") {
|
||||
continue
|
||||
}
|
||||
path, filename := filepath.Split(tagname)
|
||||
log.Log(INFO, "gitpb.IsBranch() tag:", path, filename, "from", repo.GetGoPath())
|
||||
if filename == findname {
|
||||
log.Log(INFO, "gitpb.IsBranch() found tag:", path, filename, "from", repo.GetGoPath())
|
||||
return true
|
||||
}
|
||||
}
|
||||
log.Log(INFO, "did not find tag:", findname, "in", repo.GetGoPath())
|
||||
return false
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue