diff options
| author | Jeff Carr <[email protected]> | 2024-01-09 09:35:54 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-01-09 09:35:54 -0600 |
| commit | 1f52d3083efb7768b8d7e21c7b9761c029b62584 (patch) | |
| tree | 8ddf07f8a4e2442019b6850941467927483ddf39 /git.go | |
| parent | 3aced19260bfac158f78730b1259cba51b059321 (diff) | |
more stuff
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'git.go')
| -rw-r--r-- | git.go | 92 |
1 files changed, 92 insertions, 0 deletions
@@ -0,0 +1,92 @@ +// This is a simple example +package main + +import ( + "strings" + + "go.wit.com/log" + +// "go.wit.com/gui/gui" +// "go.wit.com/gui/gadgets" +// "go.wit.com/apps/control-panel-dns/smartwindow" +) + +func (r *repo) checkoutBranch(branch string) { + if ! r.checkDirty() { + out := run(r.path, "git", "checkout " + branch) + log.Warn(r.path, "git checkout " + branch, "returned", out) + } + r.getCurrentBranchName() + r.getCurrentBranchVersion() +} + +func (r *repo) getBranch() { + out := run(r.path, "git", "branch --show-current") + r.bLabel.SetText(out) +} + +func (r *repo) checkDirty() bool { + out := run(r.path, "git", "diff-index HEAD") + if out == "" { + r.sLabel.SetText("") + r.pButton.Disable() + return false + } else { + r.sLabel.SetText("dirty") + r.pButton.Enable() + return true + } + +} + +func (r *repo) getLastTagVersion() string { + out := run(r.path, "git", "rev-list --tags --max-count=1") + out = strings.TrimSpace(out) + r.lasttagrev = out + + lastreal := "describe --tags " + out + // out = run(r.path, "git", "describe --tags c871d5ecf051a7dc4e3a77157cdbc0a457eb9ae1") + out = run(r.path, "git", lastreal) + r.lasttag = out + r.lastLabel.SetText(out) + + return out +} + +func (r *repo) getCurrentBranchName() string { + out := run(r.path, "git", "branch --show-current") + r.bLabel.SetText(out) + return out +} + +func (r *repo) getCurrentBranchVersion() string { + log.Info("r.path", r.path) + out := run(r.path, "git", "describe --tags") + r.vLabel.SetText(out) + return out +} + +func (r *repo) populateTags() { + r.tags = listFiles(fullpath(r.path + "/.git/refs/tags")) + for _, tag := range r.tags { + r.tagsDrop.AddText(tag) + } + r.tagsDrop.SetText(r.lasttag) +} + +func (r *repo) scan() { + + r.getLastTagVersion() + r.getCurrentBranchName() + r.getCurrentBranchVersion() + r.checkDirty() + + r.populateTags() +} + +func checkrepos() { + for i, r := range allrepos { + log.Warn("scannning", i, r.path) + r.scan() + } +} |
