summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2025-10-10 16:34:18 -0500
committerJeff Carr <[email protected]>2025-10-10 16:34:18 -0500
commitc3433e0556d4441f1e81f171a924d38c0e14ce4c (patch)
treeae21111e21af7814f97db7aa0edafbc636e292d9
parent4656c1d17ae0da1519863f7879b2cd7dd60df5bf (diff)
add stateChange field. prepare to rev patch.proto
-rw-r--r--Makefile6
-rw-r--r--patch.proto69
-rw-r--r--patch.proto.next70
-rw-r--r--tablePatches.go10
4 files changed, 119 insertions, 36 deletions
diff --git a/Makefile b/Makefile
index 143f2da..6c40268 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,12 @@
all: set.pb.go goimports vet
@echo This GO code passes the compile checks
+proto-renumber: clean
+ autogenpb --renumber --proto set.proto
+ autogenpb --renumber --proto patch.proto
+ autogenpb --renumber --proto forgeConfig.proto
+ make goimports vet
+
set.pb.go: set.proto
make generate
diff --git a/patch.proto b/patch.proto
index aa06095..b1445c2 100644
--- a/patch.proto
+++ b/patch.proto
@@ -30,41 +30,42 @@ import "google/protobuf/timestamp.proto"; // Import the well-known type for Time
// git log -1 --format="%H %aI %cI %an %ae %cn %ce"
message Patch {
- string namespace = 1; // the base repo git namespace
- bytes data = 2; // the raw data of the whole patch
- string gH = 3; // Commit Hash (%H)
- string gT = 4; // Tree Hash (%T)
- string gP = 5; // Parent Hashes (%P)
- string gs = 6; // Subject (%s)
- string gaI = 7; // Author Date, ISO 8601 format (%aI)
- string gan = 8; // Author Name (%an)
- string gae = 9; // Author Email (%ae)
- string gcI = 10; // Committer Date, ISO 8601 format (%cI)
- string gcn = 11; // Committer Name (%cn)
- string gce = 12; // Committer Email (%ce)
- string gN = 13; // Commit Notes (%N)
- string gGG = 14; // GPG Signature, raw (%GG)
- string gGS = 15; // GPG Signer Name (%GS)
- string gGK = 16; // GPG Key ID (%GK)
- string newHash = 17; // new hash
- string state = 18; // the 'state' of the patch
- string filename = 19; // `autogenpb:unique` `autogenpb:sort`
- string startHash = 20; // the start commit hash
- string commitHash = 21; // the git commit hash of this patch `autogenpb:sort` `autogenpb:unique`
- string comment = 22; // the git commit message (in patch form)
- repeated string Files = 23; // the filenames this patch changes
- google.protobuf.Timestamp ctime = 24; // create time of the patch
- bool applied = 25; // have you applied this patch?
- bool upstream = 26; // has this patch been applied upstream?
- string patchId = 27; // patchId `autogenpb:unique`
- string treeHash = 28; // final tree Hash
+ string namespace = 1; // the base repo git namespace
+ bytes data = 2; // the raw data of the whole patch
+ string gH = 3; // Commit Hash (%H)
+ string gT = 4; // Tree Hash (%T)
+ string gP = 5; // Parent Hashes (%P)
+ string gs = 6; // Subject (%s)
+ string gaI = 7; // Author Date, ISO 8601 format (%aI)
+ string gan = 8; // Author Name (%an)
+ string gae = 9; // Author Email (%ae)
+ string gcI = 10; // Committer Date, ISO 8601 format (%cI)
+ string gcn = 11; // Committer Name (%cn)
+ string gce = 12; // Committer Email (%ce)
+ string gN = 13; // Commit Notes (%N)
+ string gGG = 14; // GPG Signature, raw (%GG)
+ string gGS = 15; // GPG Signer Name (%GS)
+ string gGK = 16; // GPG Key ID (%GK)
+ string newHash = 17; // new hash
+ string state = 18; // the 'state' of the patch
+ string filename = 19; // `autogenpb:unique` `autogenpb:sort`
+ string startHash = 20; // the start commit hash
+ string commitHash = 21; // the git commit hash of this patch `autogenpb:sort` `autogenpb:unique`
+ string comment = 22; // the git commit message (in patch form)
+ repeated string Files = 23; // the filenames this patch changes
+ google.protobuf.Timestamp ctime = 24; // create time of the patch
+ bool applied = 25; // have you applied this patch?
+ bool upstream = 26; // has this patch been applied upstream?
+ string patchId = 27; // patchId `autogenpb:unique`
+ string treeHash = 28; // final tree Hash
+ string stateChange = 29; // more weird stuff
}
// this is a "PATCH: [1/x]" series
-message Patches { // `autogenpb:marshal` `autogenpb:gui:Patch` `autogenpb:http`
- string uuid = 1; // `autogenpb:uuid:2679065e-c81d-4a00-aca4-03c158a834fb`
- string version = 2; // `autogenpb:version:v2.0.0`
- repeated Patch patches = 3;
- string filename = 4; // `autogenpb:save` -- this enables autogenerated pb.Load() and pb.Save()
- string Errors = 5; // `autogenpb:error`
+message Patches { // `autogenpb:marshal` `autogenpb:gui:Patch` `autogenpb:http`
+ string uuid = 1; // `autogenpb:uuid:2679065e-c81d-4a00-aca4-03c158a834fb`
+ string version = 2; // `autogenpb:version:v2.0.0`
+ repeated Patch patches = 3;
+ string filename = 4; // `autogenpb:save` -- this enables autogenerated pb.Load() and pb.Save()
+ string Errors = 5; // `autogenpb:error`
}
diff --git a/patch.proto.next b/patch.proto.next
new file mode 100644
index 0000000..8958ac6
--- /dev/null
+++ b/patch.proto.next
@@ -0,0 +1,70 @@
+// Copyright 2025 WIT.COM Inc Licensed GPL 3.0
+
+syntax = "proto3";
+
+package forgepb;
+
+import "google/protobuf/timestamp.proto"; // Import the well-known type for Timestamp
+
+// Forge doesn't need this kind of specificity
+// but this is what the patch files contain and how git sees them
+// message Blob {
+// string hunkLine = 1;
+// bytes data = 2;
+// }
+//
+// message File {
+// string filename = 1;
+// string hashLine = 2;
+// repeated Blob Blobs = 3;
+// }
+//
+// message Patch {
+// repeated File Files = 1;
+// string repoNamespace = 2;
+// string gH = 3;
+// string gaI = 4;
+// string gcI = 5;
+// }
+
+// git log -1 --format="%H %aI %cI %an %ae %cn %ce"
+
+message Patch {
+ string namespace = 1; // the base repo git namespace
+ bytes data = 2; // the raw data of the whole patch
+ string gH = 3; // Commit Hash (%H)
+ string gT = 4; // Tree Hash (%T)
+ string gP = 5; // Parent Hashes (%P)
+ string gs = 6; // Subject (%s)
+ string gaI = 7; // Author Date, ISO 8601 format (%aI)
+ string gan = 8; // Author Name (%an)
+ string gae = 9; // Author Email (%ae)
+ string gcI = 10; // Committer Date, ISO 8601 format (%cI)
+ string gcn = 11; // Committer Name (%cn)
+ string gce = 12; // Committer Email (%ce)
+ string gN = 13; // Commit Notes (%N)
+ string gGG = 14; // GPG Signature, raw (%GG)
+ string gGS = 15; // GPG Signer Name (%GS)
+ string gGK = 16; // GPG Key ID (%GK)
+ string filename = 17; // `autogenpb:unique` `autogenpb:sort`
+ string comment = 18; // the git commit message (in patch form)
+ string patchId = 19; // patchId `autogenpb:unique`
+ string commitHash = 20; // the git commit hash of this patch `autogenpb:sort` `autogenpb:unique`
+ string newHash = 21; // new hash
+ string startHash = 22; // the start commit hash
+ string treeHash = 23; // final tree Hash
+ repeated string Files = 24; // the filenames this patch changes
+ google.protobuf.Timestamp ctime = 25; // create time of the patch
+ bool applied = 26; // have you applied this patch?
+ bool upstream = 27; // has this patch been applied upstream?
+ string state = 28; // the 'state' of the patch
+}
+
+// this is a "PATCH: [1/x]" series
+message Patches { // `autogenpb:marshal` `autogenpb:gui:Patch` `autogenpb:http`
+ string uuid = 1; // `autogenpb:uuid:2679065e-c81d-4a00-aca4-03c158a834fb`
+ string version = 2; // `autogenpb:version:v2.1.0`
+ repeated Patch patches = 3;
+ string filename = 4; // `autogenpb:save` -- this enables autogenerated pb.Load() and pb.Save()
+ string Errors = 5; // `autogenpb:error`
+}
diff --git a/tablePatches.go b/tablePatches.go
index 8c55ca1..8f77cc1 100644
--- a/tablePatches.go
+++ b/tablePatches.go
@@ -37,7 +37,7 @@ func (pb *Patches) PrintTable() string {
tablePB := pb.MakeTable()
tablePB.PrintTable()
- return log.Sprintf("pb.DefaultTable: %d patches\n", pb.Len())
+ return log.Sprintf("default patches table %d patches\n", pb.Len())
}
func (pb *Patches) MakeTable() *PatchesTable {
@@ -62,7 +62,13 @@ func (pb *Patches) MakeTable() *PatchesTable {
})
col.Width = 4
+ col = t.AddState()
+ col.Width = 20
+
+ col = t.AddStateChange()
+ col.Width = 20
+
col = t.AddComment()
- col.Width = 80
+ col.Width = -1
return t
}