start to move branch name logic here
This commit is contained in:
parent
87c3ec3100
commit
410fee5007
4
Makefile
4
Makefile
|
@ -33,11 +33,9 @@ clean:
|
|||
install:
|
||||
make -C forgeConfig install
|
||||
|
||||
autogenpb:
|
||||
autogenpb --proto forgeConfig.proto --sort "ByPath,GoPath" --marshal ForgeConfigs
|
||||
|
||||
forgeConfig.pb.go: forgeConfig.proto
|
||||
# I'm using version v1.35.x from google.golang.org/protobuf/cmd/protoc-gen-go
|
||||
cd ~/go/src && protoc --go_out=. --proto_path=go.wit.com/lib/protobuf/forgepb \
|
||||
--go_opt=MforgeConfig.proto=go.wit.com/lib/protobuf/forgepb \
|
||||
forgeConfig.proto
|
||||
autogenpb --proto forgeConfig.proto --sort "ByPath,GoPath" --marshal ForgeConfigs
|
||||
|
|
53
scanGoSrc.go
53
scanGoSrc.go
|
@ -23,9 +23,10 @@ func (f *Forge) ScanGoSrc() (bool, error) {
|
|||
if err != nil {
|
||||
log.Log(FORGEPBWARN, "init failed", err)
|
||||
panic("crapnuts")
|
||||
} else {
|
||||
log.Info("init worked for", newr.GoPath)
|
||||
}
|
||||
log.Info("init worked for", newr.GoPath)
|
||||
// try to guess what the 'master' branch is
|
||||
|
||||
} else {
|
||||
log.Log(FORGEPBWARN, "ScanGoSrc() bad:", dir)
|
||||
}
|
||||
|
@ -90,3 +91,51 @@ func IsGitDir(dir string) bool {
|
|||
}
|
||||
return info.IsDir()
|
||||
}
|
||||
|
||||
// attempt's to guess at what master is.
|
||||
// TODO: fix this properly
|
||||
func (repo *Repo) guessMainWorkingName() {
|
||||
if repo.IsBranch("guimaster") {
|
||||
return
|
||||
}
|
||||
if repo.IsBranch("master") {
|
||||
return
|
||||
}
|
||||
if rs.TagExists("main") {
|
||||
return
|
||||
}
|
||||
|
||||
// figure out what to do here
|
||||
rs.mainWorkingName.SetText("FIXME")
|
||||
rs.mainBranchVersion.SetLabel("FIXME")
|
||||
}
|
||||
|
||||
func (rs *RepoStatus) guessDevelWorkingName() {
|
||||
if rs.TagExists("guidevel") {
|
||||
rs.develWorkingName.SetValue("guidevel")
|
||||
rs.develBranchVersion.SetLabel("guidevel")
|
||||
return
|
||||
}
|
||||
if rs.TagExists("devel") {
|
||||
rs.develWorkingName.SetValue("devel")
|
||||
rs.develBranchVersion.SetLabel("devel")
|
||||
return
|
||||
}
|
||||
|
||||
// figure out what to do here
|
||||
rs.develWorkingName.SetValue("develFIXME")
|
||||
rs.develBranchVersion.SetLabel("develFIXME")
|
||||
}
|
||||
|
||||
func (rs *RepoStatus) setUserWorkingName() {
|
||||
usr, _ := user.Current()
|
||||
uname := usr.Username
|
||||
if rs.TagExists(uname) {
|
||||
rs.userWorkingName.SetValue(uname)
|
||||
rs.userBranchVersion.SetLabel(uname)
|
||||
return
|
||||
}
|
||||
rs.userWorkingName.SetValue("need to create " + uname)
|
||||
rs.userBranchVersion.SetLabel("need to create " + uname)
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue