work on new protobuf for patchsets

This commit is contained in:
Jeff Carr 2025-01-08 10:11:17 -06:00
parent 4f84a4e584
commit f9dd82cdcc
5 changed files with 60 additions and 4 deletions

View File

@ -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 {

View File

@ -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)

View File

@ -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() + ") "
}

View File

@ -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)
}

37
patchset.proto Normal file
View File

@ -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;
}