window with only unapplied patches
This commit is contained in:
parent
edc362f4b9
commit
aed4c92713
40
doGui.go
40
doGui.go
|
@ -193,19 +193,6 @@ func drawWindow(win *gadgets.GenericWindow) {
|
|||
releaseWin = makeModeMasterWin()
|
||||
})
|
||||
|
||||
/*
|
||||
// the Devel / Patch mode window
|
||||
var patchWin *patchesWindow
|
||||
gridM.NewButton("Patch Window", func() {
|
||||
if patchWin != nil {
|
||||
patchWin.Toggle()
|
||||
return
|
||||
}
|
||||
patchWin = new(patchesWindow)
|
||||
patchWin.initWindow()
|
||||
patchWin.Show()
|
||||
})
|
||||
*/
|
||||
var patches *stdPatchsetTableWin
|
||||
gridM.NewButton("Patch Window", func() {
|
||||
if patches != nil {
|
||||
|
@ -234,6 +221,33 @@ func drawWindow(win *gadgets.GenericWindow) {
|
|||
reposWin = makeReposWin()
|
||||
})
|
||||
|
||||
var patchesWin *stdPatchTableWin
|
||||
gridM.NewButton("Pending patches", func() {
|
||||
if patchesWin != nil {
|
||||
patchesWin.Toggle()
|
||||
return
|
||||
}
|
||||
loadUpstreamPatchsets()
|
||||
if me.psets == nil {
|
||||
log.Info("failed to download current patchsets")
|
||||
return
|
||||
}
|
||||
notdone := new(forgepb.Patches)
|
||||
|
||||
all := me.psets.All()
|
||||
for all.Scan() {
|
||||
pset := all.Next()
|
||||
AddNotDonePatches(notdone, pset)
|
||||
}
|
||||
|
||||
for patch := range notdone.IterAll() {
|
||||
comment := cleanSubject(patch.Comment)
|
||||
log.Info("new patch:", patch.NewHash, "commithash:", patch.CommitHash, patch.RepoNamespace, comment)
|
||||
}
|
||||
// savePatchsets()
|
||||
patchesWin = makePatchesWin(notdone)
|
||||
})
|
||||
|
||||
// set the initial button state based on the last
|
||||
// forge mode the user saved in the config file
|
||||
switch me.forge.Config.Mode {
|
||||
|
|
|
@ -36,24 +36,7 @@ func (w *stdPatchsetTableWin) Toggle() {
|
|||
w.win.Toggle()
|
||||
}
|
||||
|
||||
func makePatchsetsWin() *stdPatchsetTableWin {
|
||||
dwin := new(stdPatchsetTableWin)
|
||||
dwin.win = gadgets.NewGenericWindow("forge current patchsets", "patchset options")
|
||||
dwin.win.Custom = func() {
|
||||
log.Info("test delete window here")
|
||||
}
|
||||
grid := dwin.win.Group.RawGrid()
|
||||
|
||||
grid.NewButton("ondisk", func() {
|
||||
openPatchsets()
|
||||
if me.psets == nil {
|
||||
log.Info("No Patchsets loaded")
|
||||
return
|
||||
}
|
||||
dwin.doPatchsetsTable(me.psets)
|
||||
})
|
||||
|
||||
grid.NewButton("upstream", func() {
|
||||
func loadUpstreamPatchsets() {
|
||||
psets, err := me.forge.GetPatchesets()
|
||||
if err != nil {
|
||||
log.Info("Get Patchsets failed", err)
|
||||
|
@ -77,12 +60,33 @@ func makePatchsetsWin() *stdPatchsetTableWin {
|
|||
}
|
||||
}
|
||||
}
|
||||
dwin.doPatchsetsTable(psets)
|
||||
if foundnew {
|
||||
log.Info("should save these here")
|
||||
me.psets = psets
|
||||
savePatchsets()
|
||||
}
|
||||
}
|
||||
|
||||
func makePatchsetsWin() *stdPatchsetTableWin {
|
||||
dwin := new(stdPatchsetTableWin)
|
||||
dwin.win = gadgets.NewGenericWindow("forge current patchsets", "patchset options")
|
||||
dwin.win.Custom = func() {
|
||||
log.Info("test delete window here")
|
||||
}
|
||||
grid := dwin.win.Group.RawGrid()
|
||||
|
||||
grid.NewButton("ondisk", func() {
|
||||
openPatchsets()
|
||||
if me.psets == nil {
|
||||
log.Info("No Patchsets loaded")
|
||||
return
|
||||
}
|
||||
dwin.doPatchsetsTable(me.psets)
|
||||
})
|
||||
|
||||
grid.NewButton("upstream", func() {
|
||||
loadUpstreamPatchsets()
|
||||
dwin.doPatchsetsTable(me.psets)
|
||||
})
|
||||
|
||||
grid.NewButton("save", func() {
|
||||
|
@ -354,7 +358,12 @@ func setNewCommitHash(p *forgepb.Patchset) bool {
|
|||
|
||||
func AddNotDonePatches(notdone *forgepb.Patches, pset *forgepb.Patchset) {
|
||||
for patch := range pset.Patches.IterAll() {
|
||||
// parts := strings.Fields(patch.Comment)
|
||||
comment := cleanSubject(patch.Comment)
|
||||
|
||||
if found := notdone.FindByCommitHash(patch.CommitHash); found != nil {
|
||||
log.Info("duplicate notdone patch:", patch.NewHash, "commithash:", patch.CommitHash, patch.RepoNamespace, comment)
|
||||
continue
|
||||
}
|
||||
|
||||
repo := me.forge.FindByGoPath(patch.RepoNamespace)
|
||||
if repo == nil {
|
||||
|
@ -363,8 +372,6 @@ func AddNotDonePatches(notdone *forgepb.Patches, pset *forgepb.Patchset) {
|
|||
continue
|
||||
}
|
||||
|
||||
comment := cleanSubject(patch.Comment)
|
||||
|
||||
if patch.NewHash != "na" {
|
||||
log.Info("already applied patch: newhash:", patch.NewHash, "commithash:", patch.CommitHash, patch.RepoNamespace, comment)
|
||||
continue
|
||||
|
@ -379,6 +386,6 @@ func AddNotDonePatches(notdone *forgepb.Patches, pset *forgepb.Patchset) {
|
|||
|
||||
// this patch has not been applied yet
|
||||
log.Info("patch: not found hash:", patch.CommitHash, patch.RepoNamespace, comment, newhash, err)
|
||||
notdone.Append(patch)
|
||||
notdone.AppendByCommitHash(patch) // double check to ensure the commit hash isn't added twice
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue