From 888442708cefe9e089bb97a99e696cb6995bfbab Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Wed, 3 Sep 2025 05:50:30 -0500 Subject: making patch handling better --- humanTable.go | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'humanTable.go') diff --git a/humanTable.go b/humanTable.go index ecd114a..99fec97 100644 --- a/humanTable.go +++ b/humanTable.go @@ -6,6 +6,7 @@ import ( "fmt" "path/filepath" + "go.wit.com/lib/cobol" "go.wit.com/lib/gui/shell" "go.wit.com/lib/protobuf/gitpb" "go.wit.com/log" @@ -321,3 +322,35 @@ func (f *Forge) printForgedToTable(repo *gitpb.Repo, sizes []int) { log.Info(start, end) } + +func (psets *Patchsets) PrintTable() { + if psets == nil { + return + } + log.DaemonMode(true) + + // print the header + args := []string{"commit hash", "what", "age", "cId", "partId", "", "", "", "", ""} + sizes := []int{36, 3, 3, 40, 80, 2, 2, 2, 2, 2} + log.Info(cobol.StandardTableSize10(sizes, args)) + + var countCONTENTS int + var countPARTS int + for x, pset := range psets.GetPatchsets() { + log.Info(pset.Uuid, pset.Name) + cId := log.Sprintf("%d", x) + countCONTENTS += 1 + for i, p := range pset.Patches.GetPatches() { + var args []string + partId := log.Sprintf("%d", i) + + _, fname := filepath.Split(p.GetFilename()) + args = []string{p.CommitHash, cId, partId, fname, p.GetNamespace(), "", "", "", "", ""} + + start := cobol.StandardTableSize10(sizes, args) + log.Info(start) + countPARTS += 1 + } + } + log.Infof("Total Contents (%d) Parts (%d)\n", countCONTENTS, countPARTS) +} -- cgit v1.2.3