diff --git a/reload.go b/reload.go index 24c92d7..0f15698 100644 --- a/reload.go +++ b/reload.go @@ -19,6 +19,8 @@ func (repo *Repo) Reload() error { repo.ParseGoSum() // also sets GoPrimitive repo.reloadVersions() repo.setRepoType() + repo.CheckDirty() + repo.setRepoState() // everything has been checked, now save the mtime's repo.updateMtimes() diff --git a/reloadRepoState.go b/reloadRepoState.go new file mode 100644 index 0000000..322c5b0 --- /dev/null +++ b/reloadRepoState.go @@ -0,0 +1,38 @@ +package gitpb + +// does processing on the go.mod and go.sum files + +import ( + "go.wit.com/log" +) + +func (repo *Repo) setRepoState() { + if repo == nil { + return + } + if repo.IsDirty() { + repo.State = "dirty" + return + } + if repo.GetUserVersion() != repo.GetDevelVersion() { + repo.State = "merge to devel" + return + } + if repo.GetDevelVersion() != repo.GetMasterVersion() { + repo.State = "merge to main" + return + } + if repo.GetLastTag() != repo.GetMasterVersion() { + repo.State = "unchanged" + return + } + + if repo.CheckBranches() { + repo.State = "PERFECT" + return + } + log.Info("Branches are not Perfect", repo.GetFullPath()) + log.Info("Branches are not Perfect", repo.GetFullPath()) + log.Info("Branches are not Perfect", repo.GetFullPath()) + repo.State = "unknown branches" +} diff --git a/repo.proto b/repo.proto index fab47cb..19f62e1 100644 --- a/repo.proto +++ b/repo.proto @@ -28,12 +28,12 @@ message Repo { // `autogenpb:marshal` string targetVersion = 15; // useful during the package release process bool readOnly = 16; // tracks access to 'git push' string desc = 17; // what is this repo? - string state = 18; // status or state. useful for building tooling + string stateChange = 18; // used for debugging tool logic string masterVersion = 19; // just store this for now string develVersion = 20; // string userVersion = 21; // repeated string dirtyList = 22; // store the list from git status --porcelain - string stateChange = 23; // used for debugging tool logic + string state = 23; // status or state. useful for building tooling } message Repos { // `autogenpb:marshal`