apply patches working more smoothly
This commit is contained in:
parent
a6c0edb89d
commit
f6a79c3be8
22
doPatch.go
22
doPatch.go
|
@ -6,6 +6,7 @@ package main
|
||||||
import (
|
import (
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
|
||||||
|
"go.wit.com/lib/fhelp"
|
||||||
"go.wit.com/lib/protobuf/forgepb"
|
"go.wit.com/lib/protobuf/forgepb"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
@ -60,12 +61,17 @@ func doPatch() error {
|
||||||
|
|
||||||
if argv.Patch.List != nil {
|
if argv.Patch.List != nil {
|
||||||
var changed bool
|
var changed bool
|
||||||
|
newpatches := forgepb.NewPatches()
|
||||||
for pset := range me.forge.Patchsets.IterAll() {
|
for pset := range me.forge.Patchsets.IterAll() {
|
||||||
log.Info(pset.Uuid)
|
log.Info(pset.Uuid)
|
||||||
for patch := range pset.Patches.IterAll() {
|
for patch := range pset.Patches.IterAll() {
|
||||||
if setNewCommitHash(patch) {
|
if setNewCommitHash(patch) {
|
||||||
changed = true
|
changed = true
|
||||||
}
|
}
|
||||||
|
if patch.NewHash == "na" {
|
||||||
|
newpatches.Append(patch)
|
||||||
|
log.Info("apply this patch?")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -84,6 +90,22 @@ func doPatch() error {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
me.forge.Patchsets.PrintTable()
|
me.forge.Patchsets.PrintTable()
|
||||||
|
if newpatches.Len() != 0 {
|
||||||
|
for patch := range newpatches.IterAll() {
|
||||||
|
log.Info("new patch:", patch.CommitHash, patch.NewHash, patch.Filename)
|
||||||
|
repo := me.forge.FindByGoPath(patch.Namespace)
|
||||||
|
if repo == nil {
|
||||||
|
log.Info("\tCould not find namespace:", patch.Namespace)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if fhelp.QuestionUser("apply this patch?") {
|
||||||
|
newhash, err := applyAndTrackPatch(repo, patch)
|
||||||
|
log.Info("apply results:", newhash, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return log.Errorf("patches need to be applied")
|
||||||
|
}
|
||||||
|
|
||||||
// return doPatchList()
|
// return doPatchList()
|
||||||
applied := findApplied()
|
applied := findApplied()
|
||||||
if applied.Len() == 0 {
|
if applied.Len() == 0 {
|
||||||
|
|
Loading…
Reference in New Issue