Compare commits

..

4 Commits

Author SHA1 Message Date
Jeff Carr 9c87e1a040 print the table of the patches 2025-09-23 09:36:05 -05:00
Jeff Carr bda5fb4fbe set PB tables are working 2025-09-23 09:02:00 -05:00
Jeff Carr 1e3f4a3b9f new .proto files 2025-09-23 07:43:30 -05:00
Jeff Carr e300719241 cleanup tag list 2025-09-22 23:02:59 -05:00
6 changed files with 79 additions and 71 deletions

14
argv.go
View File

@ -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,19 +171,11 @@ 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:

View File

@ -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
@ -184,7 +193,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())

View File

@ -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()
@ -80,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
}

61
doc.go
View File

@ -1,40 +1,41 @@
/*
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'.
Options:
--debugger open the debugger window
--logger open the log.* control window
--gui GUI select the plugin (andlabs,gocui,etc)
--gui-verbose enable all logging
--bash generate bash completion
--bash generate bash completion
--connect CONNECT forge url
--all git commit --all
--build BUILD build a repo
--install INSTALL install a repo
--forge-rebuild download and rebuild forge
--force try to strong arm things
--verbose show more output
--help, -h display this help and exit
--version display version and exit
--debugger open the debugger window
--logger open the log.* control window
--gui GUI select the plugin (andlabs,gocui,etc)
--gui-verbose enable all logging
--bash generate bash completion
--bash generate bash completion
--connect CONNECT forge url
--all git commit --all
--build BUILD build a repo
--install INSTALL install a repo
--forge-rebuild download and rebuild forge
--force try to strong arm things
--verbose show more output
--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
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
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
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

View File

@ -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
@ -209,7 +209,7 @@ func setNewCommitHash(patch *forgepb.Patch) bool {
}
/*
func setNewCommitHashLoop(p *forgepb.Patchset) bool {
func setNewCommitHashLoop(p *forgepb.Set) bool {
var done bool = true
for patch := range p.Patches.IterAll() {
setNewCommitHashLoop(patch)
@ -219,7 +219,7 @@ func setNewCommitHashLoop(p *forgepb.Patchset) bool {
}
*/
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 +233,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)

View File

@ -21,8 +21,8 @@ type repoPatchWindow struct {
shelf *gui.Node // the first box in the stack, set as horizontal
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
setgrid *gui.Node // the list of each patchset
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)