move submit patchset to forgepb
This commit is contained in:
parent
bbf5f79acb
commit
345c1ee9b1
13
doPatches.go
13
doPatches.go
|
@ -1,13 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
func doSubmit(name string) {
|
||||
if err := sendDevelDiff(name); err != nil {
|
||||
log.Info("sending patches failed", err)
|
||||
} else {
|
||||
log.Info("sent patch set ok")
|
||||
}
|
||||
}
|
5
main.go
5
main.go
|
@ -150,7 +150,10 @@ func main() {
|
|||
|
||||
if argv.Patch != nil {
|
||||
if argv.Patch.Submit != "" {
|
||||
doSubmit(argv.Patch.Submit)
|
||||
_, err := me.forge.SubmitDevelPatchSet(argv.Patch.Submit)
|
||||
if err != nil {
|
||||
badExit(err)
|
||||
}
|
||||
okExit("")
|
||||
}
|
||||
|
||||
|
|
19
send.go
19
send.go
|
@ -3,7 +3,6 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
@ -12,7 +11,7 @@ import (
|
|||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
func sendPatches(pset *forgepb.Patchset) error {
|
||||
func submitPatches(pset *forgepb.Patchset) error {
|
||||
var url string
|
||||
url = me.urlbase + "/patchset"
|
||||
msg, err := pset.Marshal()
|
||||
|
@ -28,7 +27,6 @@ func sendPatches(pset *forgepb.Patchset) error {
|
|||
}
|
||||
|
||||
test := strings.TrimSpace(string(body))
|
||||
// log.Info("virtigo returned body:", test)
|
||||
for _, line := range strings.Split(test, "\n") {
|
||||
log.Info("got back:", line)
|
||||
}
|
||||
|
@ -121,28 +119,19 @@ func getPatch(pbfile string) (*forgepb.Patchset, error) {
|
|||
return pset, nil
|
||||
}
|
||||
|
||||
/*
|
||||
func sendDevelDiff(name string) error {
|
||||
pset, err := me.forge.MakeDevelPatchSet()
|
||||
pset, err := me.forge.MakeDevelPatchSet(name)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
pset.Name = name
|
||||
if os.Getenv("GIT_AUTHOR_NAME") == "" {
|
||||
return fmt.Errorf("GIT_AUTHOR_NAME not set")
|
||||
} else {
|
||||
pset.GitAuthorName = os.Getenv("GIT_AUTHOR_NAME")
|
||||
}
|
||||
if os.Getenv("GIT_AUTHOR_EMAIL") == "" {
|
||||
return fmt.Errorf("GIT_AUTHOR_EMAIL not set")
|
||||
} else {
|
||||
pset.GitAuthorEmail = os.Getenv("GIT_AUTHOR_EMAIL")
|
||||
}
|
||||
|
||||
if err := sendPatches(pset); err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
*/
|
||||
|
||||
func sendMasterDiff() {
|
||||
pset, err := me.forge.MakeMasterPatchSet()
|
||||
|
|
|
@ -1,61 +0,0 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"sync"
|
||||
|
||||
"go.wit.com/lib/gadgets"
|
||||
"go.wit.com/log"
|
||||
|
||||
"go.wit.com/gui"
|
||||
)
|
||||
|
||||
// Shout out to "Go Generics 101" by Tapir Liu. Buy this book!
|
||||
|
||||
type Lockable[T any] struct {
|
||||
mu sync.Mutex
|
||||
data T
|
||||
}
|
||||
|
||||
func (l *Lockable[T]) Do(f func(*T)) {
|
||||
}
|
||||
|
||||
func (l *Lockable[T]) Hide() {
|
||||
log.Info("testing:", l)
|
||||
}
|
||||
|
||||
type applyWindow struct {
|
||||
win *gadgets.BasicWindow
|
||||
box *gui.Node
|
||||
|
||||
// the top box of the repolist window
|
||||
topbox *gui.Node
|
||||
}
|
||||
|
||||
type C3 = interface {
|
||||
Show()
|
||||
Hide()
|
||||
Hidden() bool
|
||||
Enable()
|
||||
Disable()
|
||||
~*gadgets.BasicWindow | ~*gui.Node
|
||||
}
|
||||
|
||||
func (r applyWindow) Hidden() bool {
|
||||
return r.win.Hidden()
|
||||
}
|
||||
|
||||
func (r applyWindow) Show() {
|
||||
r.win.Show()
|
||||
}
|
||||
|
||||
func (r applyWindow) Hide() {
|
||||
r.win.Hide()
|
||||
}
|
||||
|
||||
func (r applyWindow) Disable() {
|
||||
r.box.Disable()
|
||||
}
|
||||
|
||||
func (r applyWindow) Enable() {
|
||||
r.box.Enable()
|
||||
}
|
|
@ -6,6 +6,7 @@ import (
|
|||
|
||||
"go.wit.com/gui"
|
||||
"go.wit.com/lib/gadgets"
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
type patchSummary struct {
|
||||
|
@ -74,8 +75,14 @@ func (r *patchesWindow) submitPatchesBox(box *gui.Node) *patchSummary {
|
|||
s.submitB.Disable()
|
||||
}
|
||||
}
|
||||
s.submitB = s.grid.NewButton("Create", func() {
|
||||
doSubmit(s.reason.String())
|
||||
s.submitB = s.grid.NewButton("Submit", func() {
|
||||
pset, err := me.forge.SubmitDevelPatchSet(s.reason.String())
|
||||
if err != nil {
|
||||
log.Info(err)
|
||||
return
|
||||
}
|
||||
line := "somedate some reason Author: me" + pset.GitAuthorEmail
|
||||
me.patchWin.addPatchset(line)
|
||||
})
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in New Issue