add a date and a uuid to the patchset

This commit is contained in:
Jeff Carr 2025-02-02 13:31:05 -06:00
parent ab01c2cd60
commit 9baa477990
2 changed files with 10 additions and 1 deletions

View File

@ -6,9 +6,12 @@ import (
"os"
"path/filepath"
"strings"
"time"
"github.com/google/uuid"
"go.wit.com/lib/protobuf/gitpb"
"go.wit.com/log"
timestamppb "google.golang.org/protobuf/types/known/timestamppb"
)
// creates a patchset
@ -16,6 +19,8 @@ import (
func (f *Forge) MakeDevelPatchSet(name string) (*Patchset, error) {
pset := new(Patchset)
pset.Name = name
pset.Ctime = timestamppb.New(time.Now())
pset.Uuid = uuid.New().String()
if os.Getenv("GIT_AUTHOR_NAME") == "" {
return nil, fmt.Errorf("GIT_AUTHOR_NAME not set")
} else {
@ -142,7 +147,9 @@ func (pset *Patchset) makePatchSetNew(repo *gitpb.Repo) error {
return nil
}
return pset.addPatchFiles(repo)
err = pset.addPatchFiles(repo)
pset.Ctime = timestamppb.New(time.Now())
return err
}
// process each file in pDir/
@ -184,6 +191,7 @@ func (p *Patchset) addPatchFiles(repo *gitpb.Repo) error {
p.Patches = new(Patches)
}
p.Patches.Append(patch)
p.Patches.Uuid = uuid.New().String()
// log.Info("ADDED PATCH FILE", path)
return nil
})

View File

@ -38,6 +38,7 @@ message Patchset { // `autogenpb:mars
string startBranchHash = 10; //
string endBranchHash = 11; //
string state = 12; // the state of the patch
string uuid = 13; // identify each patchset somehow
}
message Patchsets { // `autogenpb:marshal`