more work on patches
This commit is contained in:
parent
19ce7eef56
commit
78e883a106
2
Makefile
2
Makefile
|
@ -7,7 +7,7 @@ BUILDTIME = $(shell date +%Y.%m.%d_%H%M)
|
|||
# make andlabs # try the andlabs gui plugin (uses GTK)
|
||||
|
||||
default: verbose install
|
||||
forge patch list
|
||||
forge patch
|
||||
|
||||
vet:
|
||||
@GO111MODULE=off go vet
|
||||
|
|
3
argv.go
3
argv.go
|
@ -66,7 +66,8 @@ type PatchCmd struct {
|
|||
List *EmptyCmd `arg:"subcommand:list" help:"your downloaded patchsets"`
|
||||
Get *EmptyCmd `arg:"subcommand:get" help:"get the new patchsets"`
|
||||
Show *EmptyCmd `arg:"subcommand:show" help:"your pending commits to your code"`
|
||||
Submit *SubmitCmd `arg:"subcommand:submit" help:"submit your commits"`
|
||||
Submit *SubmitCmd `arg:"subcommand:submit" help:"submit your commits"`
|
||||
Repos *SubmitCmd `arg:"subcommand:repos" help:"show repos with patches"`
|
||||
}
|
||||
|
||||
type SubmitCmd struct {
|
||||
|
|
|
@ -46,7 +46,7 @@ func (args) doBashAuto() {
|
|||
case "pull":
|
||||
fmt.Println("dirty clean list patches --force")
|
||||
case "patch":
|
||||
fmt.Println("check get list submit show")
|
||||
fmt.Println("check get list repos submit show")
|
||||
case "user":
|
||||
fmt.Println("--force")
|
||||
case "devel":
|
||||
|
|
43
doGui.go
43
doGui.go
|
@ -14,6 +14,7 @@ import (
|
|||
"go.wit.com/lib/fhelp"
|
||||
"go.wit.com/lib/gadgets"
|
||||
"go.wit.com/lib/gui/shell"
|
||||
"go.wit.com/lib/protobuf/forgepb"
|
||||
"go.wit.com/lib/protobuf/gitpb"
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
@ -168,28 +169,32 @@ func drawWindow(win *gadgets.GenericWindow) {
|
|||
patchesWin.Toggle()
|
||||
return
|
||||
}
|
||||
// me.forge.GetPatches()
|
||||
// loadUpstreamPatchsets()
|
||||
/*
|
||||
if me.psets == nil {
|
||||
log.Info("failed to download current patchsets")
|
||||
return
|
||||
// load the current patches protobuf file
|
||||
if err := me.forge.LoadPatchsets(); err != nil {
|
||||
log.Info("patches failed to open", err)
|
||||
if err := me.forge.SavePatchsets(); err != nil {
|
||||
log.Warn("savePatchsets() failed", err)
|
||||
}
|
||||
notdone := new(forgepb.Patches)
|
||||
}
|
||||
// patchesWin = makePatchesWin(me.forge.Patchsets)
|
||||
notdone := new(forgepb.Patches)
|
||||
|
||||
all := me.psets.All()
|
||||
for all.Scan() {
|
||||
pset := all.Next()
|
||||
AddNotDonePatches(notdone, pset, false)
|
||||
}
|
||||
if me.forge.Patchsets == nil {
|
||||
log.Info("patchsets == nil")
|
||||
return
|
||||
}
|
||||
all := me.forge.Patchsets.All()
|
||||
for all.Scan() {
|
||||
pset := all.Next()
|
||||
AddAllPatches(notdone, pset, false)
|
||||
// AddNotDonePatches(notdone, pset, false)
|
||||
}
|
||||
|
||||
for patch := range notdone.IterAll() {
|
||||
comment := cleanSubject(patch.Comment)
|
||||
log.Info("new patch:", patch.NewHash, "commithash:", patch.CommitHash, patch.Namespace, comment)
|
||||
}
|
||||
// savePatchsets()
|
||||
patchesWin = makePatchesWin(notdone)
|
||||
*/
|
||||
for patch := range notdone.IterAll() {
|
||||
comment := cleanSubject(patch.Comment)
|
||||
log.Info("new patch:", patch.NewHash, "commithash:", patch.CommitHash, patch.Namespace, comment)
|
||||
}
|
||||
patchesWin = makePatchesWin(notdone)
|
||||
})
|
||||
|
||||
var pubWin *gadgets.GenericWindow
|
||||
|
|
|
@ -13,7 +13,7 @@ import (
|
|||
)
|
||||
|
||||
func doNormal() bool {
|
||||
me.forge.CheckDirty()
|
||||
me.forge.CheckDirtyQuiet()
|
||||
|
||||
var count int
|
||||
stats := me.forge.RillRepos(checkNormalRepoState)
|
||||
|
|
17
doPatch.go
17
doPatch.go
|
@ -56,18 +56,27 @@ func doPatch() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
if argv.Patch.Repos != nil {
|
||||
dumpDirtyRepos()
|
||||
}
|
||||
|
||||
// if nothing, show patches & dirty repos
|
||||
me.forge.Patchsets.PrintTable()
|
||||
dumpDirtyRepos()
|
||||
return nil
|
||||
}
|
||||
|
||||
func dumpDirtyRepos() {
|
||||
// always run dirty first
|
||||
me.forge.CheckDirty()
|
||||
me.forge.CheckDirtyQuiet()
|
||||
|
||||
// if no option is given to patch, list out the
|
||||
// repos that have patches ready in them
|
||||
found := findReposWithPatches()
|
||||
if found.Len() == 0 {
|
||||
log.Info("you currently have no patches in your user branches")
|
||||
return nil
|
||||
log.Info("you currently have no repos with patches")
|
||||
}
|
||||
me.forge.PrintHumanTable(found)
|
||||
return nil
|
||||
}
|
||||
|
||||
// returns bad if patches can not be applied
|
||||
|
|
|
@ -178,7 +178,6 @@ func setNewCommitHash(p *forgepb.Patchset) bool {
|
|||
return done
|
||||
}
|
||||
|
||||
/*
|
||||
func AddNotDonePatches(notdone *forgepb.Patches, pset *forgepb.Patchset, full bool) {
|
||||
for patch := range pset.Patches.IterAll() {
|
||||
comment := cleanSubject(patch.Comment)
|
||||
|
@ -222,4 +221,18 @@ func AddNotDonePatches(notdone *forgepb.Patches, pset *forgepb.Patchset, full bo
|
|||
notdone.AppendByCommitHash(patch) // double check to ensure the commit hash isn't added twice
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
func AddAllPatches(notdone *forgepb.Patches, pset *forgepb.Patchset, full bool) {
|
||||
for patch := range pset.Patches.IterAll() {
|
||||
comment := cleanSubject(patch.Comment)
|
||||
|
||||
if found := notdone.FindByCommitHash(patch.CommitHash); found != nil {
|
||||
log.Info("duplicate commit hash", patch.Namespace, "patch:", patch.NewHash, "commithash:", patch.CommitHash, comment)
|
||||
continue
|
||||
}
|
||||
newhash, _ := findCommitByHash(patch.StartHash, comment)
|
||||
|
||||
log.Info("adding patch:", patch.Namespace, patch.CommitHash, comment, newhash)
|
||||
notdone.AppendByCommitHash(patch) // double check to ensure the commit hash isn't added twice
|
||||
}
|
||||
}
|
||||
|
|
|
@ -158,6 +158,16 @@ func (dwin *stdPatchTableWin) doPatchesTable(currentPatches *forgepb.Patches) {
|
|||
dwin.TB.Custom(f)
|
||||
}
|
||||
|
||||
// used by the PB table
|
||||
func funcApplyPatch(p *forgepb.Patch) string {
|
||||
rn := p.Namespace
|
||||
if repo := me.forge.FindByGoPath(rn); repo == nil {
|
||||
// log.Info("Could not figure out repo path", rn)
|
||||
return ""
|
||||
}
|
||||
return "git am"
|
||||
}
|
||||
|
||||
// define what rows to have in the protobuf table
|
||||
func AddPatchesPB(tbox *gui.Node, pb *forgepb.Patches) *forgepb.PatchesTable {
|
||||
t := pb.NewTable("PatchesPB")
|
||||
|
|
Loading…
Reference in New Issue