summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-01-08 10:11:17 -0600
committerJeff Carr <[email protected]>2025-01-08 10:11:17 -0600
commitf9dd82cdcc6db632bfdecf2623e7e1486a37c6b3 (patch)
treeafb822a45cc63ae13c879c0bd644aee5ec9c868a
parent4f84a4e584ff49f4351c236df633f1c690ccbda5 (diff)
work on new protobuf for patchsets
-rw-r--r--gitCheckout.go2
-rw-r--r--humanShowRepo.go4
-rw-r--r--humanTable.go17
-rw-r--r--init.go4
-rw-r--r--patchset.proto37
5 files changed, 60 insertions, 4 deletions
diff --git a/gitCheckout.go b/gitCheckout.go
index 727cf8c..b1d07d9 100644
--- a/gitCheckout.go
+++ b/gitCheckout.go
@@ -139,11 +139,11 @@ func (f *Forge) CheckoutUser() bool {
all := f.Repos.SortByFullPath()
for all.Scan() {
repo := all.Next()
- count += 1
if repo.GetCurrentBranchName() == repo.GetUserBranchName() {
// already on the user branch
continue
}
+ count += 1
if repo.CheckoutUser() {
// checkout ok
} else {
diff --git a/humanShowRepo.go b/humanShowRepo.go
index a1d462b..1416d3b 100644
--- a/humanShowRepo.go
+++ b/humanShowRepo.go
@@ -53,6 +53,10 @@ func (f *Forge) HumanPrintRepo(check *gitpb.Repo) {
log.Info("IsProtobuf() ERROR = ", err)
}
}
+ log.Info("git master name ==", check.GetMasterBranchName())
+ log.Info("git devel name ==", check.GetDevelBranchName())
+ log.Info("git user name ==", check.GetUserBranchName())
+ log.Info("git current name ==", check.GetCurrentBranchName())
// testNext(check)
diff --git a/humanTable.go b/humanTable.go
index 0fe2f31..bc6add5 100644
--- a/humanTable.go
+++ b/humanTable.go
@@ -35,13 +35,16 @@ import (
func (f *Forge) PrintHumanTable(allr *gitpb.Repos) {
log.DaemonMode(true)
+ var count int
// log.Info(standardStart5("gopath", "cur name", "master", "user", "repo type"))
log.Info(standardTable8("repopath", "cur br", "age", "target", "master", "devel", "user", "curver", "repo type"))
all := allr.SortByFullPath()
for all.Scan() {
repo := all.Next()
f.sendRepoToTable(repo)
+ count += 1
}
+ log.Info("Total git repositories:", count)
}
func standardTable5(arg1, arg2, arg3, arg4, arg5 string) string {
@@ -156,7 +159,19 @@ func (f *Forge) sendRepoToTable(repo *gitpb.Repo) {
end += "(m:" + repo.GetMasterBranchName() + ") "
}
- if repo.GetState() != "" {
+ if repo.GetDevelBranchName() != "devel" {
+ end += "(d:" + repo.GetDevelBranchName() + ") "
+ }
+
+ if repo.GetUserBranchName() != f.Config.Username {
+ end += "(u:" + repo.GetUserBranchName() + ") "
+ }
+
+ switch repo.GetState() {
+ case "PERFECT":
+ case "unchanged":
+ // end += "(invalid tag) "
+ default:
end += "(" + repo.GetState() + ") "
}
diff --git a/init.go b/init.go
index 644ee74..c58629d 100644
--- a/init.go
+++ b/init.go
@@ -107,10 +107,10 @@ func (f *Forge) SetConfigSave(b bool) {
// saves the config if there have been changes
func (f *Forge) Exit() {
- log.Info("forge.configSave =", f.configSave)
+ // log.Info("forge.configSave =", f.configSave)
if f.configSave {
f.ConfigSave()
}
- log.Info("forge.Exit() ok")
+ // log.Info("forge.Exit() ok")
os.Exit(0)
}
diff --git a/patchset.proto b/patchset.proto
new file mode 100644
index 0000000..afb725a
--- /dev/null
+++ b/patchset.proto
@@ -0,0 +1,37 @@
+syntax = "proto3";
+
+package forgepb;
+
+import "google/protobuf/timestamp.proto"; // Import the well-known type for Timestamp
+
+message Patch {
+ string filename = 1; // `autogenpb:unique`
+ bytes data = 2; //
+ string repoPath = 3; // path to the git repo
+ string branchName = 4; //
+ string branchHash = 5; //
+ google.protobuf.Timestamp ctime = 7; // the git commit timestamp of this patch
+ string commitHash = 8; // the git commit hash of this patch
+ string startHash = 9; // the start commit hash
+ repeated string Files = 10; // the filenames this patch changes
+}
+
+message Patchset { // `autogenpb:marshal`
+ repeated Patch Patches = 1;
+ string name = 2; //
+ string comment = 3; //
+ string gitAuthorName = 4; //
+ string gitAuthorEmail = 5; //
+ google.protobuf.Timestamp ctime = 6; // create time of this patchset
+ string tmpDir = 7; // temp dir
+ string startBranchName = 8; //
+ string endBranchName = 9; //
+ string startBranchHash = 10; //
+ string endBranchHash = 11; //
+}
+
+message Patchsets { // `autogenpb:marshal`
+ string uuid = 1; // `autogenpb:uuid:be926ad9-f07f-484c-adf2-d96eeabf3079` // todo: add autogenpb support for this
+ string version = 2; // could be used for protobuf schema change violations?
+ repeated Patchset Patchsets = 3;
+}