individual 'git am' buttons
This commit is contained in:
parent
695da486d2
commit
6012733385
|
@ -149,15 +149,6 @@ func AddPatchsetsPB(tbox *gui.Node, pb *forgepb.Patchsets) *forgepb.PatchsetsTab
|
||||||
return fmt.Sprintf("%d", p.Patches.Len())
|
return fmt.Sprintf("%d", p.Patches.Len())
|
||||||
})
|
})
|
||||||
|
|
||||||
testf := func(p *forgepb.Patchset) string {
|
|
||||||
return "validate"
|
|
||||||
}
|
|
||||||
tp := t.AddButtonFunc("Analyze", testf)
|
|
||||||
tp.Custom = func(p *forgepb.Patchset) {
|
|
||||||
setPatchsetState(p)
|
|
||||||
log.Info("patchset state", p.Name, "is", p.State)
|
|
||||||
}
|
|
||||||
|
|
||||||
vp := t.AddButtonFunc("View Patchset", func(p *forgepb.Patchset) string {
|
vp := t.AddButtonFunc("View Patchset", func(p *forgepb.Patchset) string {
|
||||||
return p.Name
|
return p.Name
|
||||||
})
|
})
|
||||||
|
|
|
@ -94,6 +94,24 @@ func makePatchesWin(patches *forgepb.Patches) *stdPatchTableWin {
|
||||||
return dwin
|
return dwin
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func applyPatchNew(p *forgepb.Patch) error {
|
||||||
|
rn := p.RepoNamespace
|
||||||
|
repo := me.forge.FindByGoPath(rn)
|
||||||
|
if repo == nil {
|
||||||
|
return fmt.Errorf("Could not figure out repo path %s", rn)
|
||||||
|
}
|
||||||
|
filename, err := savePatch(p)
|
||||||
|
if err != nil {
|
||||||
|
log.Info("savePatch() failed", err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if err := applyPatch(repo, filename); err != nil {
|
||||||
|
log.Info("warn user of git am error", err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
func (dwin *stdPatchTableWin) doPatchesTable(currentPatches *forgepb.Patches) {
|
func (dwin *stdPatchTableWin) doPatchesTable(currentPatches *forgepb.Patches) {
|
||||||
dwin.Lock()
|
dwin.Lock()
|
||||||
defer dwin.Unlock()
|
defer dwin.Unlock()
|
||||||
|
@ -116,6 +134,18 @@ func AddPatchesPB(tbox *gui.Node, pb *forgepb.Patches) *forgepb.PatchesTable {
|
||||||
t.NewUuid()
|
t.NewUuid()
|
||||||
t.SetParent(tbox)
|
t.SetParent(tbox)
|
||||||
|
|
||||||
|
gitam := t.AddButtonFunc("apply", func(p *forgepb.Patch) string {
|
||||||
|
return "git am"
|
||||||
|
})
|
||||||
|
gitam.Custom = func(p *forgepb.Patch) {
|
||||||
|
if err := applyPatchNew(p); err != nil {
|
||||||
|
log.Info("git am failed on file", p.Filename, "with error", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
log.Info("ran: git am", p.Filename, "ok")
|
||||||
|
}
|
||||||
|
|
||||||
|
t.AddCommitHash()
|
||||||
t.AddRepoNamespace()
|
t.AddRepoNamespace()
|
||||||
// t.AddFilename()
|
// t.AddFilename()
|
||||||
t.AddStringFunc("file", func(p *forgepb.Patch) string {
|
t.AddStringFunc("file", func(p *forgepb.Patch) string {
|
||||||
|
|
Loading…
Reference in New Issue