list branches
This commit is contained in:
parent
205b1fe1ed
commit
dd2f7ed01d
|
@ -5,6 +5,8 @@ package main
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
"strings"
|
||||
"sync"
|
||||
|
||||
"go.wit.com/gui"
|
||||
|
@ -88,7 +90,7 @@ func makePatchsetsWin() *stdPatchsetTableWin {
|
|||
savePatchsets()
|
||||
})
|
||||
|
||||
grid.NewButton("analyse and save patchsets", func() {
|
||||
grid.NewButton("set patchset state", func() {
|
||||
if me.psets == nil {
|
||||
log.Info("No Patchsets loaded")
|
||||
return
|
||||
|
@ -106,6 +108,24 @@ func makePatchsetsWin() *stdPatchsetTableWin {
|
|||
savePatchsets()
|
||||
})
|
||||
|
||||
grid.NewButton("find commit hashes", func() {
|
||||
if me.psets == nil {
|
||||
log.Info("No Patchsets loaded")
|
||||
return
|
||||
}
|
||||
all := me.psets.All()
|
||||
for all.Scan() {
|
||||
pset := all.Next()
|
||||
if pset.State == "" {
|
||||
log.Info("What is up with?", pset.Name)
|
||||
setNewCommitHash(pset)
|
||||
} else {
|
||||
log.Info("patchset already had state", pset.Name, pset.State)
|
||||
}
|
||||
}
|
||||
savePatchsets()
|
||||
})
|
||||
|
||||
// make a box at the bottom of the window for the protobuf table
|
||||
dwin.box = dwin.win.Bottom.Box().SetProgName("TBOX")
|
||||
|
||||
|
@ -192,6 +212,15 @@ func AddPatchsetsPB(tbox *gui.Node, pb *forgepb.Patchsets) *forgepb.PatchsetsTab
|
|||
|
||||
t.AddUuid()
|
||||
|
||||
newCommit := t.AddButtonFunc("new hash", func(p *forgepb.Patchset) string {
|
||||
return "find"
|
||||
})
|
||||
newCommit.Custom = func(pset *forgepb.Patchset) {
|
||||
log.Info("find new commits here", pset.Name)
|
||||
// makePatchesWin(pset.Patches)
|
||||
setNewCommitHash(pset)
|
||||
}
|
||||
|
||||
t.ShowTable()
|
||||
return t
|
||||
}
|
||||
|
@ -240,3 +269,58 @@ func setPatchsetState(p *forgepb.Patchset) {
|
|||
return
|
||||
}
|
||||
}
|
||||
|
||||
func cleanSubject(line string) string {
|
||||
// Regular expression to remove "Subject:" and "[PATCH...]" patterns
|
||||
re := regexp.MustCompile(`(?i)^Subject:\s*(\[\s*PATCH[^\]]*\]\s*)?`)
|
||||
cleaned := re.ReplaceAllString(line, "")
|
||||
return strings.TrimSpace(cleaned)
|
||||
}
|
||||
|
||||
func setNewCommitHash(p *forgepb.Patchset) {
|
||||
for patch := range p.Patches.IterAll() {
|
||||
// parts := strings.Fields(patch.Comment)
|
||||
|
||||
repo := me.forge.FindByGoPath(patch.RepoNamespace)
|
||||
if repo == nil {
|
||||
log.Info("couldn't find repo", patch.RepoNamespace)
|
||||
continue
|
||||
}
|
||||
|
||||
comment := cleanSubject(patch.Comment)
|
||||
|
||||
if patch.NewHash != "na" {
|
||||
log.Info("patch: newhash:", patch.NewHash, "commithash:", patch.CommitHash, patch.RepoNamespace, comment)
|
||||
continue
|
||||
}
|
||||
log.Info("patch: not found hash:", patch.CommitHash, patch.RepoNamespace, comment)
|
||||
for dep := range repo.GoDeps.IterAll() {
|
||||
log.Info("dep:", dep.Name)
|
||||
}
|
||||
return
|
||||
|
||||
/*
|
||||
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
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue