add a date and a uuid to the patchset
This commit is contained in:
parent
ab01c2cd60
commit
9baa477990
|
@ -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
|
||||
})
|
||||
|
|
|
@ -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`
|
||||
|
|
Loading…
Reference in New Issue