fields for 'forge pull'
This commit is contained in:
parent
da649abceb
commit
97fe127345
|
@ -7,7 +7,7 @@ import (
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (repo *Repo) DevelHash() string {
|
func (repo *Repo) ActualDevelHash() string {
|
||||||
brname := repo.GetDevelBranchName()
|
brname := repo.GetDevelBranchName()
|
||||||
refname := "refs/heads/" + brname
|
refname := "refs/heads/" + brname
|
||||||
for tag := range repo.Tags.IterAll() {
|
for tag := range repo.Tags.IterAll() {
|
||||||
|
|
|
@ -0,0 +1,44 @@
|
||||||
|
package gitpb
|
||||||
|
|
||||||
|
import (
|
||||||
|
"bytes"
|
||||||
|
"net/http"
|
||||||
|
"net/url"
|
||||||
|
"os"
|
||||||
|
"os/user"
|
||||||
|
|
||||||
|
"go.wit.com/lib/protobuf/httppb"
|
||||||
|
"go.wit.com/log"
|
||||||
|
)
|
||||||
|
|
||||||
|
func (p *Repos) HttpPost(baseURL string, route string) (*Repos, error) {
|
||||||
|
// if you ever have "http://www.wit.com//" GO will regect the server recieving it.
|
||||||
|
// Even though the linux kernel gets the network payload
|
||||||
|
// also it never gives you an error about that, it just goes away invisably inside GO
|
||||||
|
tmpURL, _ := url.Parse(baseURL) // "http://forge.grid.wit.com:2520")
|
||||||
|
finalURL := tmpURL.JoinPath("/repos/", route)
|
||||||
|
|
||||||
|
data, _ := p.Marshal()
|
||||||
|
|
||||||
|
var err error
|
||||||
|
var req *http.Request
|
||||||
|
|
||||||
|
log.Info("reposs PB HttpPost", finalURL.String())
|
||||||
|
req, err = http.NewRequest(http.MethodPost, finalURL.String(), bytes.NewBuffer(data))
|
||||||
|
if req == nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
usr, _ := user.Current()
|
||||||
|
req.Header.Set("author", usr.Username)
|
||||||
|
hostname, _ := os.Hostname()
|
||||||
|
req.Header.Set("hostname", hostname)
|
||||||
|
|
||||||
|
newdata, err := httppb.PostReq(req)
|
||||||
|
|
||||||
|
newpb := NewRepos()
|
||||||
|
err = newpb.Unmarshal(newdata)
|
||||||
|
|
||||||
|
log.Infof("repos PB HttpPost %s sent len(%d) got len(%d)\n", finalURL.String(), p.Len(), newpb.Len())
|
||||||
|
return newpb, err
|
||||||
|
}
|
|
@ -68,6 +68,8 @@ message Repo { // `autogenpb
|
||||||
string state = 23; // status or state. useful for building tooling
|
string state = 23; // status or state. useful for building tooling
|
||||||
GitTag currentTag = 24; // used to examine repo branches
|
GitTag currentTag = 24; // used to examine repo branches
|
||||||
GitConfig gitConfig = 25; // protobuf of the current .git/config
|
GitConfig gitConfig = 25; // protobuf of the current .git/config
|
||||||
|
string MasterHash = 26; // hash of the current master branch
|
||||||
|
string DevelHash = 27; // hash of the current devel branch
|
||||||
}
|
}
|
||||||
|
|
||||||
message Repos { // `autogenpb:marshal` `autogenpb:sort` `autogenpb:gui` `autogenpb:nomutex`
|
message Repos { // `autogenpb:marshal` `autogenpb:sort` `autogenpb:gui` `autogenpb:nomutex`
|
||||||
|
|
Loading…
Reference in New Issue