Compare commits
12 Commits
Author | SHA1 | Date |
---|---|---|
|
e0520ca96d | |
|
6d7d74feb4 | |
|
9c87e1a040 | |
|
bda5fb4fbe | |
|
1e3f4a3b9f | |
|
e300719241 | |
|
a9c4b21b35 | |
|
37aebd9d73 | |
|
5a54f9c0b2 | |
|
31db2f96f6 | |
|
3a967eac13 | |
|
17a62eb8da |
16
argv.go
16
argv.go
|
@ -155,7 +155,7 @@ func DoAutoComplete(pb *prep.Auto) {
|
|||
case "checkout":
|
||||
pb.Autocomplete2("devel master user")
|
||||
case "clean":
|
||||
fmt.Println("--force verify --repo")
|
||||
pb.Autocomplete2("")
|
||||
case "commit":
|
||||
pb.Autocomplete2("--all")
|
||||
case "config":
|
||||
|
@ -171,26 +171,18 @@ func DoAutoComplete(pb *prep.Auto) {
|
|||
case "merge":
|
||||
pb.Autocomplete2("devel master --all")
|
||||
case "normal":
|
||||
fmt.Println("on off")
|
||||
pb.Autocomplete2("on off")
|
||||
case "pull":
|
||||
fmt.Println("--force check")
|
||||
pb.Autocomplete2("--force check")
|
||||
case "patch":
|
||||
fmt.Println("check get list repos submit show")
|
||||
case "user":
|
||||
fmt.Println("--force")
|
||||
case "devel":
|
||||
fmt.Println("--force")
|
||||
case "master":
|
||||
fmt.Println("")
|
||||
case "verify":
|
||||
fmt.Println("user devel master")
|
||||
case "tag":
|
||||
fmt.Println("list --delete clean")
|
||||
default:
|
||||
if pb.Cmd == "" {
|
||||
pb.Autocomplete2("help list checkout clean commit dirty fetch gui normal merge patch pull tag --gui")
|
||||
} else {
|
||||
pb.Autocomplete2("list checkout clean commit dirty normal merge")
|
||||
pb.Autocomplete2("list checkout clean commit dirty normal merge tag")
|
||||
}
|
||||
}
|
||||
os.Exit(0)
|
||||
|
|
|
@ -8,6 +8,7 @@ import (
|
|||
|
||||
"go.wit.com/lib/config"
|
||||
"go.wit.com/lib/protobuf/forgepb"
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
func forgeConfigSave() error {
|
||||
|
@ -18,6 +19,7 @@ func setForgeMode(fmode forgepb.ForgeMode) {
|
|||
if me.forge.Config.Mode == fmode {
|
||||
return
|
||||
}
|
||||
log.Info("changing mode", me.forge.Config.Mode, fmode)
|
||||
me.forge.Config.Mode = fmode
|
||||
config.SetChanged("forge", true)
|
||||
me.forge.Config.ConfigSave()
|
||||
|
|
|
@ -27,6 +27,7 @@ func doCheckout() error {
|
|||
}
|
||||
|
||||
if argv.Checkout.Devel != nil {
|
||||
// setForgeMode(forgepb.ForgeMode_DEVEL)
|
||||
if err := me.forge.DoAllCheckoutDevelNew(argv.Force); err != nil {
|
||||
badExit(err)
|
||||
}
|
||||
|
@ -34,7 +35,7 @@ func doCheckout() error {
|
|||
}
|
||||
|
||||
if argv.Checkout.Master != nil {
|
||||
setForgeMode(forgepb.ForgeMode_CLEAN) // disable "normal" mode if set
|
||||
setForgeMode(forgepb.ForgeMode_MASTER) // disable "normal" mode if set
|
||||
|
||||
if err := me.forge.DoAllCheckoutMaster(); err != nil {
|
||||
badExit(err)
|
||||
|
|
49
doMerge.go
49
doMerge.go
|
@ -4,12 +4,61 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"go.wit.com/lib/config"
|
||||
"go.wit.com/lib/gui/shell"
|
||||
"go.wit.com/lib/protobuf/forgepb"
|
||||
"go.wit.com/lib/protobuf/gitpb"
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
func doMerge() error {
|
||||
if argv.All == true {
|
||||
start := time.Now()
|
||||
repos, err := doMergeDevel()
|
||||
dur := time.Since(start)
|
||||
if err != nil {
|
||||
badExit(err)
|
||||
}
|
||||
log.Printf("Merged %d devel branches in %s\n", repos.Len(), shell.FormatDuration(dur))
|
||||
|
||||
start = time.Now()
|
||||
repos, err = doMergeMaster()
|
||||
dur = time.Since(start)
|
||||
if err != nil {
|
||||
badExit(err)
|
||||
}
|
||||
log.Printf("Merged %d master branches in %s\n", repos.Len(), shell.FormatDuration(dur))
|
||||
okExit("")
|
||||
}
|
||||
if argv.Merge.Devel != nil {
|
||||
start := time.Now()
|
||||
repos, err := doMergeDevel()
|
||||
dur := time.Since(start)
|
||||
if err != nil {
|
||||
badExit(err)
|
||||
}
|
||||
log.Printf("Merged %d devel branches in %s\n", repos.Len(), shell.FormatDuration(dur))
|
||||
okExit("")
|
||||
}
|
||||
if argv.Merge.Master != nil {
|
||||
start := time.Now()
|
||||
repos, err := doMergeMaster()
|
||||
dur := time.Since(start)
|
||||
if err != nil {
|
||||
badExit(err)
|
||||
}
|
||||
log.Printf("Merged %d master branches in %s\n", repos.Len(), shell.FormatDuration(dur))
|
||||
okExit("")
|
||||
}
|
||||
repo := findCurrentPwdRepoOrDie()
|
||||
if err := repoMergeToDevel(repo); err != nil {
|
||||
badRepoExit(repo, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func doMergeReport() *forgepb.Patches {
|
||||
found := forgepb.NewPatches()
|
||||
for repo := range me.forge.Repos.IterAll() {
|
||||
|
|
|
@ -75,12 +75,15 @@ func checkNormalRepoState(repo *gitpb.Repo) error {
|
|||
log.Info("ABNORMAL: master branch name was blank in", repo.GetFullPath())
|
||||
}
|
||||
if repo.GetMasterBranchName() == "" {
|
||||
me.forge.VerifyBranchNames(repo)
|
||||
err = log.Errorf("master branch name blank")
|
||||
}
|
||||
if repo.GetDevelBranchName() == "" {
|
||||
me.forge.VerifyBranchNames(repo)
|
||||
err = log.Errorf("devel branch name blank")
|
||||
}
|
||||
if repo.GetUserBranchName() == "" {
|
||||
me.forge.VerifyBranchNames(repo)
|
||||
err = log.Errorf("user branch name blank")
|
||||
}
|
||||
if repo.GetGoPath() == repo.GetNamespace() {
|
||||
|
@ -94,7 +97,7 @@ func checkNormalRepoState(repo *gitpb.Repo) error {
|
|||
repo.VerifyRemoteAndLocalBranches(repo.GetMasterBranchName())
|
||||
|
||||
if repo.GetCurrentBranchName() != repo.GetUserBranchName() {
|
||||
log.Info("changing to user branch", repo.FullPath)
|
||||
log.Infof("changing to user(%s) branch: %s\n", repo.GetUserBranchName(), repo.FullPath)
|
||||
repo.CheckoutUser()
|
||||
repo.ReloadCheck()
|
||||
err = log.Errorf("now on user branch")
|
||||
|
|
69
doPatch.go
69
doPatch.go
|
@ -45,7 +45,16 @@ func doPatchSubmit() error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, _, err = pset.Patches.HttpPostVerbose(myServer(), "new")
|
||||
if pset.Patches == nil {
|
||||
log.Info("pset.Patches == nil")
|
||||
return err
|
||||
}
|
||||
if pset.Patches.Len() == 0 {
|
||||
log.Info("did not find any patches")
|
||||
return nil
|
||||
}
|
||||
pset.PrintTable()
|
||||
_, _, err = pset.HttpPost(myServer(), "new")
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -64,7 +73,7 @@ func doPatch() error {
|
|||
}
|
||||
|
||||
if argv.Patch.Get != nil {
|
||||
psets := forgepb.NewPatchsets()
|
||||
psets := forgepb.NewSets()
|
||||
newpb, _, _ := psets.HttpPostVerbose(myServer(), "get")
|
||||
newpb.PrintTable()
|
||||
me.forge.Patchsets = newpb
|
||||
|
@ -92,38 +101,40 @@ func doPatch() error {
|
|||
|
||||
if argv.Patch.List != nil {
|
||||
var changed bool
|
||||
newpatches := forgepb.NewPatches()
|
||||
newpatches := new(forgepb.Set)
|
||||
newpatches.Patches = forgepb.NewPatches()
|
||||
for pset := range me.forge.Patchsets.IterAll() {
|
||||
log.Info(pset.Uuid)
|
||||
pset.PrintTable()
|
||||
for patch := range pset.Patches.IterAll() {
|
||||
if setNewCommitHash(patch) {
|
||||
changed = true
|
||||
}
|
||||
if patch.NewHash == "na" {
|
||||
newpatches.Append(patch)
|
||||
log.Info("apply this patch?")
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
for patch := range pset.Patches.IterAll() {
|
||||
if repo, ok := me.forge.IsPatchApplied(patch); ok {
|
||||
log.Info("\tfound patch in repo", repo.Namespace, patch.Filename)
|
||||
if patch.NewHash == "" || patch.NewHash == "na" {
|
||||
if newpatches.Patches.AppendByPatchId(patch) {
|
||||
log.Info("patchId added here", patch.PatchId)
|
||||
} else {
|
||||
log.Info("\tdid not find patch", patch.CommitHash, patch.NewHash, patch.Filename)
|
||||
log.Info("patchId already here", patch.PatchId)
|
||||
}
|
||||
} else {
|
||||
if err := setNewCommitHash(patch); err != nil {
|
||||
log.Infof("%s bad check on patch failure %v\n", patch.Filename, err)
|
||||
return err
|
||||
}
|
||||
log.Info("newhash set already here", patch.PatchId, patch.NewHash)
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
if changed {
|
||||
if err := me.forge.SavePatchsets(); err != nil {
|
||||
log.Warn("savePatchsets() failed", err)
|
||||
}
|
||||
}
|
||||
me.forge.Patchsets.PrintTable()
|
||||
if newpatches.Len() != 0 {
|
||||
for patch := range newpatches.IterAll() {
|
||||
log.Info("new patch:", patch.CommitHash, patch.NewHash, patch.Filename)
|
||||
log.Info("NEW PATCHES TABLE")
|
||||
newpatches.PrintTable()
|
||||
for patch := range newpatches.Patches.IterAll() {
|
||||
if err := setNewCommitHash(patch); err == nil {
|
||||
log.Info("newhash set already here", patch.PatchId, patch.NewHash)
|
||||
continue
|
||||
}
|
||||
log.Infof("%s is new\n", patch.Filename)
|
||||
repo := me.forge.FindByGoPath(patch.Namespace)
|
||||
if repo == nil {
|
||||
log.Info("\tCould not find namespace:", patch.Namespace)
|
||||
|
@ -134,6 +145,17 @@ func doPatch() error {
|
|||
log.Info("apply results:", newhash, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
/*
|
||||
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
|
||||
}
|
||||
}
|
||||
return log.Errorf("patches need to be applied")
|
||||
}
|
||||
|
||||
|
@ -152,6 +174,7 @@ func doPatch() error {
|
|||
}
|
||||
newpb.PrintTable()
|
||||
return nil
|
||||
*/
|
||||
}
|
||||
|
||||
// if nothing, show patches & dirty repos
|
||||
|
@ -184,7 +207,7 @@ func dumpWorkRepos() bool {
|
|||
|
||||
// returns bad if patches can not be applied
|
||||
// logic is not great here but it was a first pass
|
||||
func dumpPatchset(pset *forgepb.Patchset) bool {
|
||||
func dumpPatchset(pset *forgepb.Set) bool {
|
||||
// don't even bother to continue if we already know it's broken
|
||||
if pset.State == "BROKEN" {
|
||||
log.Printf("Patchset Name: %-24s Author: %s <%s> IS BAD\n", pset.Name, pset.GetGitAuthorName(), pset.GetGitAuthorEmail())
|
||||
|
|
46
doTag.go
46
doTag.go
|
@ -39,7 +39,7 @@ func doTag() error {
|
|||
if argv.Tag.List != nil {
|
||||
repo := findCurrentPwdRepoOrDie()
|
||||
|
||||
tagTablePB := makeTagTablePB(repo.Tags)
|
||||
tagTablePB := makeTagTablePB(repo, repo.Tags)
|
||||
// tbox := win.Bottom.Box().SetProgName("TBOX")
|
||||
// t.SetParent(tbox)
|
||||
tagTablePB.MakeTable()
|
||||
|
@ -56,13 +56,15 @@ func doTag() error {
|
|||
}
|
||||
|
||||
// check if the git tag already exists somehow
|
||||
testtag := argv.Tag.Delete
|
||||
/*
|
||||
if !repo.LocalTagExists(testtag) {
|
||||
log.Info("Tag", testtag, "does not exist")
|
||||
return log.Errorf("%s TAG DOES NOT EXIST %s", repo.FullPath, testtag)
|
||||
}
|
||||
*/
|
||||
testtag := argv.Tag.Delete
|
||||
if !argv.Force {
|
||||
if !fhelp.QuestionUser("delete this tag?") {
|
||||
if !fhelp.QuestionUser(log.Sprintf("delete tag '%s'?", testtag)) {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
@ -78,40 +80,46 @@ func doTag() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func makeTagTablePB(pb *gitpb.GitTags) *gitpb.GitTagsTable {
|
||||
func makeTagTablePB(repo *gitpb.Repo, pb *gitpb.GitTags) *gitpb.GitTagsTable {
|
||||
t := pb.NewTable("tagList")
|
||||
t.NewUuid()
|
||||
|
||||
col := t.AddHash()
|
||||
col.Width = 12
|
||||
|
||||
col = t.AddStringFunc("Ref Name", func(r *gitpb.GitTag) string {
|
||||
_, ref := filepath.Split(r.GetRefname())
|
||||
return ref
|
||||
col = t.AddStringFunc("bashash", func(tag *gitpb.GitTag) string {
|
||||
_, base := filepath.Split(tag.Refname)
|
||||
cmd, err := repo.RunStrict([]string{"git", "log", "-1", base, "--format=%H"})
|
||||
if err != nil {
|
||||
return "err"
|
||||
}
|
||||
if len(cmd.Stdout) == 0 {
|
||||
return ""
|
||||
}
|
||||
return cmd.Stdout[0]
|
||||
})
|
||||
col.Width = 16
|
||||
// col.Width = -1
|
||||
|
||||
col = t.AddTimeFunc("age", func(repo *gitpb.GitTag) time.Time {
|
||||
// todo
|
||||
return time.Now()
|
||||
})
|
||||
col.Width = 6
|
||||
col.Width = 12
|
||||
|
||||
col = t.AddTimeFunc("ctime", func(tag *gitpb.GitTag) time.Time {
|
||||
// todo
|
||||
return tag.Creatordate.AsTime()
|
||||
})
|
||||
col.Width = 16
|
||||
col.Width = 4
|
||||
|
||||
col = t.AddIntFunc("int", func(tag *gitpb.GitTag) int {
|
||||
col = t.AddTimeFunc("age", func(repo *gitpb.GitTag) time.Time {
|
||||
// todo
|
||||
return 3
|
||||
return time.Now()
|
||||
})
|
||||
col.Width = 4
|
||||
|
||||
col = t.AddSubject()
|
||||
col = t.AddStringFunc("Ref Name", func(r *gitpb.GitTag) string {
|
||||
_, ref := filepath.Split(r.GetRefname())
|
||||
return ref
|
||||
})
|
||||
col.Width = 16
|
||||
|
||||
col = t.AddSubject()
|
||||
col.Width = -1
|
||||
|
||||
return t
|
||||
}
|
||||
|
|
19
doc.go
19
doc.go
|
@ -3,20 +3,14 @@ forge -- a tool to manage lots of git repos. forge includes a GUI and TUI.
|
|||
|
||||
forge only executes the 'git' command. Everything it does, you can run by hand with 'git'.
|
||||
|
||||
forge v0.22.138-6-gaea7f16 Built on 2025.09.03_1935
|
||||
Usage: forge [--debugger] [--logger] [--no-gui] [--gui GUI] [--gui-file GUI-FILE] [--gui-build] [--gui-verbose] [--gui-check-plugin GUI-CHECK-PLUGIN] [--connect CONNECT] [--all] [--build BUILD] [--install INSTALL] [--forge-rebuild] [--force] [--verbose] [--bash] [--auto-complete AUTO-COMPLETE] <command> [<args>]
|
||||
|
||||
Options:
|
||||
|
||||
--debugger open the debugger window
|
||||
--logger open the log.* control window
|
||||
--no-gui ignore all these gui problems
|
||||
--gui GUI Use this gui toolkit [andlabs,gocui,nocui,stdin]
|
||||
--gui-file GUI-FILE Use a specific plugin.so file
|
||||
--gui-build attempt to build the GUI plugins
|
||||
--gui GUI select the plugin (andlabs,gocui,etc)
|
||||
--gui-verbose enable all logging
|
||||
--gui-check-plugin GUI-CHECK-PLUGIN
|
||||
hack to verify GO plugins load
|
||||
--bash generate bash completion
|
||||
--bash generate bash completion
|
||||
--connect CONNECT forge url
|
||||
--all git commit --all
|
||||
--build BUILD build a repo
|
||||
|
@ -24,25 +18,24 @@ Options:
|
|||
--forge-rebuild download and rebuild forge
|
||||
--force try to strong arm things
|
||||
--verbose show more output
|
||||
--bash generate bash completion
|
||||
--auto-complete AUTO-COMPLETE
|
||||
todo: move this to go-arg
|
||||
--help, -h display this help and exit
|
||||
--version display version and exit
|
||||
|
||||
Commands:
|
||||
|
||||
help New to forge? This is for you.'
|
||||
checkout switch branches using 'git checkout'
|
||||
clean start over at the beginning
|
||||
commit 'git commit' but errors out if on wrong branch
|
||||
config show your .config/forge/ settings
|
||||
debug debug forge
|
||||
dirty show dirty git repos
|
||||
fetch run 'git fetch master'
|
||||
gui open the gui
|
||||
list print a table of the current repos
|
||||
merge merge branches
|
||||
normal set every repo to the default state for software development
|
||||
patch make patchsets
|
||||
pull run 'git pull'
|
||||
tag manage git tags
|
||||
*/
|
||||
package main
|
||||
|
|
|
@ -38,7 +38,7 @@ type stdPatchsetTableWin struct {
|
|||
sync.Mutex
|
||||
win *gadgets.GenericWindow // the machines gui window
|
||||
box *gui.Node // the machines gui parent box widget
|
||||
TB *forgepb.PatchsetsTable // the gui table buffer
|
||||
TB *forgepb.SetsTable // the gui table buffer
|
||||
update bool // if the window should be updated
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,7 @@ func (w *stdPatchsetTableWin) Toggle() {
|
|||
*/
|
||||
|
||||
/*
|
||||
etimef := func(e *forgepb.Patchset) string {
|
||||
etimef := func(e *forgepb.Set) string {
|
||||
etime := e.Etime.AsTime()
|
||||
s := etime.Format("2006/01/02 15:04")
|
||||
if strings.HasPrefix(s, "1970/") {
|
||||
|
@ -67,14 +67,14 @@ func (w *stdPatchsetTableWin) Toggle() {
|
|||
*/
|
||||
|
||||
/*
|
||||
ctimef := func(p *forgepb.Patchset) string {
|
||||
ctimef := func(p *forgepb.Set) string {
|
||||
ctime := p.Ctime.AsTime()
|
||||
return ctime.Format("2006/01/02 15:04")
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
func setPatchsetState(p *forgepb.Patchset) {
|
||||
func setPatchsetState(p *forgepb.Set) {
|
||||
var bad bool
|
||||
var good bool
|
||||
var done bool = true
|
||||
|
@ -173,53 +173,33 @@ func findCommitBySubject(subject string) (string, error) {
|
|||
}
|
||||
|
||||
// returns true if PB changed
|
||||
func setNewCommitHash(patch *forgepb.Patch) bool {
|
||||
// parts := strings.Fields(patch.Comment)
|
||||
|
||||
func setNewCommitHash(patch *forgepb.Patch) error {
|
||||
repo := me.forge.FindByGoPath(patch.Namespace)
|
||||
if repo == nil {
|
||||
log.Info("could not find repo", patch.Namespace)
|
||||
return false
|
||||
return log.Errorf("could not find repo %s", patch.Namespace)
|
||||
}
|
||||
|
||||
comment := cleanSubject(patch.Comment)
|
||||
|
||||
if patch.NewHash == "" {
|
||||
log.Info("init() new patch to 'na' ", patch.NewHash, "commithash:", patch.CommitHash, patch.Namespace, comment)
|
||||
patch.NewHash = "na"
|
||||
return true
|
||||
}
|
||||
os.Chdir(repo.GetFullPath())
|
||||
newhash, err := findCommitBySubject(comment)
|
||||
if err != nil {
|
||||
log.Info("patch: not found hash:", patch.CommitHash, patch.Namespace, comment, newhash, err)
|
||||
return false
|
||||
return log.Errorf("patch: not found hash: %s %s %s %s %v", patch.CommitHash, patch.Namespace, comment, newhash, err)
|
||||
}
|
||||
if patch.NewHash == newhash {
|
||||
// patch was already set
|
||||
return false
|
||||
}
|
||||
if patch.NewHash != "na" {
|
||||
log.Infof("patch: hash MISMATCH %s old=%s new=%s name=%s\n", patch.Namespace, patch.NewHash, newhash, comment)
|
||||
return false
|
||||
|
||||
patchId, err := repo.FindPatchId(newhash)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
patch.PatchId = patchId
|
||||
patch.NewHash = newhash
|
||||
|
||||
log.Info("patch: found hash:", patch.CommitHash, newhash, patch.Namespace, comment)
|
||||
return true
|
||||
return nil
|
||||
}
|
||||
|
||||
/*
|
||||
func setNewCommitHashLoop(p *forgepb.Patchset) bool {
|
||||
var done bool = true
|
||||
for patch := range p.Patches.IterAll() {
|
||||
setNewCommitHashLoop(patch)
|
||||
}
|
||||
|
||||
return done
|
||||
}
|
||||
*/
|
||||
|
||||
func AddAllPatches(notdone *forgepb.Patches, pset *forgepb.Patchset, full bool) {
|
||||
func AddAllPatches(notdone *forgepb.Patches, pset *forgepb.Set, full bool) {
|
||||
for patch := range pset.Patches.IterAll() {
|
||||
comment := cleanSubject(patch.Comment)
|
||||
|
||||
|
@ -233,7 +213,7 @@ func AddAllPatches(notdone *forgepb.Patches, pset *forgepb.Patchset, full bool)
|
|||
}
|
||||
}
|
||||
|
||||
func AddNotDonePatches(notdone *forgepb.Patches, pset *forgepb.Patchset, full bool) {
|
||||
func AddNotDonePatches(notdone *forgepb.Patches, pset *forgepb.Set, full bool) {
|
||||
for patch := range pset.Patches.IterAll() {
|
||||
comment := cleanSubject(patch.Comment)
|
||||
|
||||
|
@ -251,7 +231,7 @@ func AddNotDonePatches(notdone *forgepb.Patches, pset *forgepb.Patchset, full bo
|
|||
continue
|
||||
}
|
||||
|
||||
if patch.NewHash != "na" {
|
||||
if patch.NewHash != "" {
|
||||
log.Info("already applied patch", patch.Namespace, ": newhash:", patch.NewHash, "commithash:", patch.CommitHash, comment)
|
||||
continue
|
||||
}
|
||||
|
@ -301,7 +281,7 @@ func findExpired() *forgepb.Patches {
|
|||
continue
|
||||
}
|
||||
|
||||
if patch.NewHash != "na" {
|
||||
if patch.NewHash != "" {
|
||||
log.Info("already applied patch", patch.Namespace, ": newhash:", patch.NewHash, "commithash:", patch.CommitHash, comment)
|
||||
found.AppendByCommitHash(patch) // double check to ensure the commit hash isn't added twice
|
||||
continue
|
||||
|
|
30
main.go
30
main.go
|
@ -8,10 +8,8 @@ package main
|
|||
import (
|
||||
"embed"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"go.wit.com/lib/gui/prep"
|
||||
"go.wit.com/lib/gui/shell"
|
||||
"go.wit.com/lib/protobuf/forgepb"
|
||||
"go.wit.com/lib/protobuf/gitpb"
|
||||
"go.wit.com/log"
|
||||
|
@ -73,7 +71,6 @@ func main() {
|
|||
}
|
||||
|
||||
if argv.Checkout != nil {
|
||||
setForgeMode(forgepb.ForgeMode_DEVEL)
|
||||
if err := doCheckout(); err != nil {
|
||||
badExit(err)
|
||||
}
|
||||
|
@ -158,34 +155,9 @@ func main() {
|
|||
}
|
||||
|
||||
if argv.Merge != nil {
|
||||
if argv.All == true {
|
||||
|
||||
if argv.Merge.Devel != nil {
|
||||
start := time.Now()
|
||||
repos, err := doMergeDevel()
|
||||
dur := time.Since(start)
|
||||
if err != nil {
|
||||
if err := doMerge(); err != nil {
|
||||
badExit(err)
|
||||
}
|
||||
log.Printf("Merged %d devel branches in %s\n", repos.Len(), shell.FormatDuration(dur))
|
||||
okExit("")
|
||||
}
|
||||
|
||||
if argv.Merge.Master != nil {
|
||||
start := time.Now()
|
||||
repos, err := doMergeMaster()
|
||||
dur := time.Since(start)
|
||||
if err != nil {
|
||||
badExit(err)
|
||||
}
|
||||
log.Printf("Merged %d master branches in %s\n", repos.Len(), shell.FormatDuration(dur))
|
||||
okExit("")
|
||||
}
|
||||
}
|
||||
repo := findCurrentPwdRepoOrDie()
|
||||
if err := repoMergeToDevel(repo); err != nil {
|
||||
badRepoExit(repo, err)
|
||||
}
|
||||
okExit("")
|
||||
}
|
||||
|
||||
|
|
|
@ -117,11 +117,8 @@ func applyPatchLabel(p *forgepb.Patch) string {
|
|||
// log.Info("Could not figure out repo path", rn)
|
||||
return ""
|
||||
}
|
||||
if p.NewHash == "na" {
|
||||
return "git am"
|
||||
}
|
||||
if p.NewHash == "" {
|
||||
return "new"
|
||||
return "git am"
|
||||
}
|
||||
return "done"
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ type repoPatchWindow struct {
|
|||
grid *gui.Node // the list of available patches
|
||||
// summary *patchSummary // summary of current patches
|
||||
setgrid *gui.Node // the list of each patchset
|
||||
pset *forgepb.Patchset // the patchset in question
|
||||
pset *forgepb.Set // the patchset in question
|
||||
}
|
||||
|
||||
// todo: autogenerate these or make them standared 'gui' package functions
|
||||
|
@ -109,7 +109,7 @@ func makeRepoPatchWindow(repo *gitpb.Repo, fset []*forgepb.Patch) *repoPatchWind
|
|||
return pw
|
||||
}
|
||||
|
||||
func (r *repoPatchWindow) addPatchset(grid *gui.Node, pset *forgepb.Patchset) {
|
||||
func (r *repoPatchWindow) addPatchset(grid *gui.Node, pset *forgepb.Set) {
|
||||
repomap := make(map[*gitpb.Repo][]*forgepb.Patch)
|
||||
repohash := make(map[*gitpb.Repo]string)
|
||||
|
||||
|
|
Loading…
Reference in New Issue