summaryrefslogtreecommitdiff
path: root/patchset.Make.go
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-03-22 05:22:04 -0500
committerJeff Carr <[email protected]>2025-03-22 05:22:04 -0500
commitb2ed4102763421924b29ab4bb6be1a1e5b4b9647 (patch)
tree679db085b742c1eb5b0f3fb75aac54507e993620 /patchset.Make.go
parent68127e4356d00604b454bfee002a7fda233fb773 (diff)
work on setting the hostname in the patchset
Diffstat (limited to 'patchset.Make.go')
-rw-r--r--patchset.Make.go54
1 files changed, 13 insertions, 41 deletions
diff --git a/patchset.Make.go b/patchset.Make.go
index 4368719..37c7c7d 100644
--- a/patchset.Make.go
+++ b/patchset.Make.go
@@ -14,13 +14,20 @@ import (
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
)
-// creates a patchset
-// works from the user branches against the devel branches
-func (f *Forge) MakeDevelPatchSet(name string) (*Patchset, error) {
+func (f *Forge) newPatchset(name string) *Patchset {
pset := new(Patchset)
pset.Name = name
pset.Ctime = timestamppb.New(time.Now())
pset.Uuid = uuid.New().String()
+ pset.Hostname = f.Machine.hostname
+
+ return pset
+}
+
+// creates a patchset
+// works from the user branches against the devel branches
+func (f *Forge) MakeDevelPatchSet(name string) (*Patchset, error) {
+ pset := newPatchset(name)
if os.Getenv("GIT_AUTHOR_NAME") == "" {
return nil, fmt.Errorf("GIT_AUTHOR_NAME not set")
} else {
@@ -65,19 +72,9 @@ func (f *Forge) MakeDevelPatchSet(name string) (*Patchset, error) {
return pset, nil
}
-func (f *Forge) SubmitDevelPatchSet(name string) (*Patchset, error) {
- pset, err := f.MakeDevelPatchSet(name)
- if err != nil {
- return nil, err
- }
- if err := f.submitPatchset(pset); err != nil {
- return nil, err
- }
- return pset, nil
-}
-
+/*
func (f *Forge) MakeMasterPatchSet() (*Patchset, error) {
- pset := new(Patchset)
+ pset := newPatchset("masterBranchPS")
dir, err := os.MkdirTemp("", "forge")
if err != nil {
return nil, err
@@ -107,6 +104,7 @@ func (f *Forge) MakeMasterPatchSet() (*Patchset, error) {
}
return pset, nil
}
+*/
func (pset *Patchset) makePatchSetNew(repo *gitpb.Repo) error {
startBranch := pset.StartBranchName
@@ -244,29 +242,3 @@ func onlyWalkDirs(pDir string) error {
})
return baderr
}
-
-func (f *Forge) submitPatchset(pset *Patchset) error {
- var url string
- url = forgeURL + "patchset"
- msg, err := pset.Marshal()
- if err != nil {
- log.Info("proto.Marshal() failed:", err)
- return err
- }
- log.Info("proto.Marshal() msg len", len(msg))
- body, err := f.HttpPost(url, msg)
- if err != nil {
- log.Info("httpPost() failed:", err)
- return err
- }
-
- test := strings.TrimSpace(string(body))
- lines := strings.Split(test, "\n")
- count := 0
- for _, line := range lines {
- log.Info("got back:", line)
- count += 1
- }
- log.Info("Total patches:", count)
- return nil
-}