start tracking patchset state
This commit is contained in:
parent
95d4e03ca4
commit
422d853020
|
@ -59,7 +59,9 @@ func makePatchsetsWin() *stdPatchsetTableWin {
|
||||||
for all.Scan() {
|
for all.Scan() {
|
||||||
pset := all.Next()
|
pset := all.Next()
|
||||||
log.Info("What is up with?", pset.Name)
|
log.Info("What is up with?", pset.Name)
|
||||||
|
setPatchsetState(pset)
|
||||||
}
|
}
|
||||||
|
savePatchsets(psets)
|
||||||
})
|
})
|
||||||
|
|
||||||
// make a box at the bottom of the window for the protobuf table
|
// make a box at the bottom of the window for the protobuf table
|
||||||
|
@ -110,12 +112,8 @@ func AddPatchsetsPB(tbox *gui.Node, pb *forgepb.Patchsets) *forgepb.PatchsetsTab
|
||||||
}
|
}
|
||||||
tp := t.AddButtonFunc("Analyze", testf)
|
tp := t.AddButtonFunc("Analyze", testf)
|
||||||
tp.Custom = func(p *forgepb.Patchset) {
|
tp.Custom = func(p *forgepb.Patchset) {
|
||||||
log.Info("check patches here", p.Name)
|
setPatchsetState(p)
|
||||||
all := p.Patches.All()
|
log.Info("patchset state", p.Name, "is", p.State)
|
||||||
for all.Scan() {
|
|
||||||
patch := all.Next()
|
|
||||||
log.Info("What is up with patches:", patch.Filename)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
vp := t.AddButtonFunc("View Patchset", func(p *forgepb.Patchset) string {
|
vp := t.AddButtonFunc("View Patchset", func(p *forgepb.Patchset) string {
|
||||||
|
@ -133,6 +131,7 @@ func AddPatchsetsPB(tbox *gui.Node, pb *forgepb.Patchsets) *forgepb.PatchsetsTab
|
||||||
}
|
}
|
||||||
|
|
||||||
t.AddComment()
|
t.AddComment()
|
||||||
|
t.AddState()
|
||||||
|
|
||||||
ctimef := func(p *forgepb.Patchset) string {
|
ctimef := func(p *forgepb.Patchset) string {
|
||||||
ctime := p.Ctime.AsTime()
|
ctime := p.Ctime.AsTime()
|
||||||
|
@ -162,3 +161,48 @@ func AddPatchsetsPB(tbox *gui.Node, pb *forgepb.Patchsets) *forgepb.PatchsetsTab
|
||||||
t.ShowTable()
|
t.ShowTable()
|
||||||
return t
|
return t
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func setPatchsetState(p *forgepb.Patchset) {
|
||||||
|
var bad bool
|
||||||
|
var good bool
|
||||||
|
var done bool = true
|
||||||
|
|
||||||
|
all := p.Patches.All()
|
||||||
|
for all.Scan() {
|
||||||
|
patch := all.Next()
|
||||||
|
// log.Info("patch:", patch.StartHash, patch.CommitHash, patch.RepoNamespace, patch.Filename)
|
||||||
|
repo := me.forge.FindByGoPath(patch.RepoNamespace)
|
||||||
|
if repo == nil {
|
||||||
|
log.Info("couldn't find repo", patch.RepoNamespace)
|
||||||
|
bad = true
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if _, err := repo.GetHashName(patch.CommitHash); err == nil {
|
||||||
|
// this patch has been applied
|
||||||
|
patch.Applied = true
|
||||||
|
done = true
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if name, err := repo.GetHashName(patch.StartHash); err == nil {
|
||||||
|
// it might be possible to apply this patch
|
||||||
|
log.Info("patch may be good:", patch.RepoNamespace, name, patch.CommitHash, patch.Filename)
|
||||||
|
good = true
|
||||||
|
} else {
|
||||||
|
// probably screwed up git trees
|
||||||
|
log.Info("patch with unknown origin:", patch.RepoNamespace, name, err, patch.CommitHash, patch.Filename)
|
||||||
|
bad = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if bad {
|
||||||
|
p.State = "BAD"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if good {
|
||||||
|
p.State = "TRY"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if done {
|
||||||
|
p.State = "DONE"
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue