summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--common.go16
-rw-r--r--configfile.go91
-rw-r--r--getPatches.go112
-rw-r--r--goConfig.go50
-rw-r--r--interface.go95
-rw-r--r--scanIterator.go40
6 files changed, 0 insertions, 404 deletions
diff --git a/common.go b/common.go
index 12d438a..ef4cc09 100644
--- a/common.go
+++ b/common.go
@@ -141,22 +141,6 @@ func (r *RepoRow) Run(cmd []string) cmd.Status {
return r.pb.Run(cmd)
}
-/*
-func (r *RepoRow) AllTags() []*repostatus.Tag {
- return r.Status.Tags.ListAll()
-}
-
-func (r *RepoRow) TagsBox() *repostatus.GitTagBox {
- return r.Status.Tags
-}
-
-// todo, fix bool return for deletetag()
-func (r *RepoRow) DeleteTag(t *repostatus.Tag) bool {
- r.Status.DeleteTag(t)
- return true
-}
-*/
-
func (rl *RepoList) MirrorShownCount() *gui.Node {
return gui.RawMirror(rl.shownCount)
}
diff --git a/configfile.go b/configfile.go
deleted file mode 100644
index d24fc8e..0000000
--- a/configfile.go
+++ /dev/null
@@ -1,91 +0,0 @@
-package repolist
-
-/*
-func (rl *RepoList) ArgGitPull() bool {
- var localonly int
- var badmap int
-
- log.Log(REPOWARN, "running git pull everywhere")
- var failed int = 0
- loop := rl.ReposSortByName()
- for loop.Scan() {
- repo := loop.Repo()
- if out, err := repo.Status.GitPull(); err == nil {
- log.Log(REPOWARN, "Ran git pull ok", repo.Status.Path(), out)
- } else {
- failed += 1
- repo.Status.DumpTags()
- if errors.Is(repostatus.ErrorGitPullOnLocal, err) {
- localonly += 1
- continue
- }
- badmap += 1
- log.Log(REPOWARN, "bad unknown git error", repo.Status.Path(), out, err)
- }
- }
- log.Log(REPOWARN, "Ran git pull in all repos. failure count =", failed)
- log.Log(REPOWARN, "Ran git pull in all repos. bad errors =", badmap)
- if localonly != 0 {
- log.Log(REPOWARN, "Ran git pull in all repos. ignored local only branches =", localonly)
- }
- return true
-}
-
-func (rl *RepoList) ArgCheckoutDevel() bool {
- log.Log(REPOWARN, "running git checkout devel everwhere")
- var failed int = 0
- var count int = 0
- loop := rl.ReposSortByName()
- for loop.Scan() {
- repo := loop.Repo()
- count += 1
- if repo.Status.CheckoutDevel() {
- // checkout ok
- } else {
- failed += 1
- }
- }
- log.Log(REPOWARN, "Ran git checkout in", count, "repos. failure count =", failed)
- return true
-}
-
-func (rl *RepoList) ArgCheckoutMaster() bool {
- log.Log(REPOWARN, "running git checkout master everwhere")
- var failed int = 0
- var count int = 0
- loop := rl.ReposSortByName()
- for loop.Scan() {
- repo := loop.Repo()
- count += 1
- if repo.Status.CheckoutMaster() {
- // checkout ok
- } else {
- failed += 1
- }
- }
- log.Log(REPOWARN, "Ran git checkout in", count, "repos. failure count =", failed)
- return true
-}
-
-func (rl *RepoList) ArgCheckoutUser() bool {
- log.Log(REPOWARN, "running git checkout master everwhere")
- var failed int = 0
- var count int = 0
- loop := rl.ReposSortByName()
- for loop.Scan() {
- repo := loop.Repo()
- count += 1
- if repo.Status.CheckoutUser() {
- // checkout ok
- } else {
- failed += 1
- }
- }
- log.Log(REPOWARN, "Ran git checkout in", count, "repos. failure count =", failed)
- return true
-}
-
-func (rl *RepoList) Cfgfile() string {
- return rl.cfgfile
-}
-*/
diff --git a/getPatches.go b/getPatches.go
deleted file mode 100644
index 46e8587..0000000
--- a/getPatches.go
+++ /dev/null
@@ -1,112 +0,0 @@
-package repolist
-
-import (
- "go.wit.com/lib/gui/repostatus"
-)
-
-type Patch struct {
- Ref string
- giturl string
- comment string
- RS *repostatus.RepoStatus
-}
-
-// move all this to repolist and gowit repos
-
-/*
-func (repo *RepoRow) GetPatches(oldname string, newname string) (int, []*Patch) {
- var patchcount int
- patches := make([]*Patch, 0, 0)
-
- if oldname == newname {
- return 0, nil
- }
- // log.Info("repo userv, develv", userv, develv)
- gitcmd := []string{"git", "log", "--oneline", oldname + ".." + newname}
- log.Info("Run:", gitcmd)
- r := repo.Status.Run(gitcmd)
- if r.Error != nil {
- log.Info("git failed ", repo.GetGoPath(), "err =", r.Error)
- return 0, nil
- }
-
- // patches = strings.Split(output, "\n")
- log.Info("Run:", r.Stdout)
- for _, line := range r.Stdout {
- line = strings.TrimSpace(line)
- if line == "" {
- continue
- }
- parts := strings.Split(line, " ")
- newp := new(Patch)
- newp.RS = repo.Status
- newp.Ref = parts[0]
- newp.comment = strings.Join(parts[1:], " ")
- log.Info("Patch line:", line, newp.RS.String())
- patchcount += 1
- patches = append(patches, newp)
- }
- return patchcount, patches
-}
-
-func (repo *RepoRow) GetUserPatches() (int, []*Patch) {
- usern := repo.Status.GetUserBranchName()
- develn := repo.Status.GetDevelBranchName()
- userv := repo.Status.GetUserVersion()
- develv := repo.Status.GetDevelVersion()
-
- if userv == develv {
- return 0, nil
- }
-
- c, all := repo.GetPatches(develn, usern)
- log.Info("GetPatches() guireleaser", develn, usern, "count =", c)
- return c, all
-}
-
-func (repo *RepoRow) GetMasterPatches() (int, []*Patch) {
- lasttag := repo.LastTag()
- mastern := repo.Status.GetMasterBranchName()
- masterv := repo.Status.GetMasterVersion()
-
- if lasttag == masterv {
- return 0, nil
- }
-
- c, all := repo.GetPatches(lasttag, mastern)
- log.Info("GetPatches() guireleaser", lasttag, mastern, "count =", c)
- return c, all
-}
-
-func isEmpty(a any) bool {
- return false
-}
-
-func (r *RepoList) MakePatchset(setdir string) bool {
- for _, repo := range r.allrepos {
- userv := repo.Status.GetUserVersion()
- develv := repo.Status.GetDevelVersion()
- usern := repo.Status.GetUserBranchName()
- develn := repo.Status.GetDevelBranchName()
- if userv == develv {
- // this repo is unchanged
- continue
- }
-
- repodir := filepath.Join(setdir, repo.GetGoPath())
- os.MkdirAll(repodir, os.ModeDir)
- // git format-patch branch1..branch2
- gitcmd := []string{"git", "format-patch", "-o", repodir, develn + ".." + usern}
- log.Info("Run:", gitcmd)
- r := repo.Status.Run(gitcmd)
- log.Info("output =", r.Stdout)
- if r.Error == nil {
- log.Info("patches made okay for:", repo.GetGoPath())
- continue
- }
- log.Info("patches failed for:", repo.GetGoPath())
- return false
- }
- return true
-}
-*/
diff --git a/goConfig.go b/goConfig.go
deleted file mode 100644
index 7ec2d5e..0000000
--- a/goConfig.go
+++ /dev/null
@@ -1,50 +0,0 @@
-package repolist
-
-// does processing on the go.mod and go.sum files
-
-/*
-// scans through everything in the go.sum file to make
-// sure the versions are correct when attempting to do a GUI release
-func (rl *RepoList) CheckValidGoSum(r *RepoRow) (bool, error) {
- log.Log(REPOWARN, "CheckValidGoSum() started")
- ok, err := r.pb.RedoGoMod()
- if !ok {
- log.Log(REPOWARN, "CheckValidGoSum() MakeRedomod() failed", err)
- return ok, err
- }
-
- // go through each go.sum dependancy to see if the package is released
- for depPath, version := range r.Status.GoConfig() {
- log.Log(REPO, " ", depPath, version)
-
- // lookup the repo
- deprs := rl.FindRepo(depPath)
- if deprs == nil {
- // well, the go.sum dependancy hasn't been processed or doesn't exist
- // so, download it? ignore it?
- // for now, if it's not one of the GUI repos, assume it's readonly and ignore it
- if strings.HasPrefix(depPath, "go.wit.com") {
- log.Log(REPOWARN, "Run: go get -v", depPath)
- return false, errors.New("CheckValidGoSum() download repo: " + depPath)
- }
- // it's probably okay. running a compile check before this would be a good test
- continue
- }
- if deprs.ReadOnly() {
- // ignore versioning on other repos. todo: help fix this situation somehow?
- continue
- }
- if deprs.CheckDirty() {
- return false, errors.New("CheckValidGoSum() depends on dirty repo " + deprs.GoPath())
- }
- currentV := deprs.Status.GetCurrentVersion()
- targetV := deprs.Status.GetTargetVersion()
- if currentV != targetV {
- return false, errors.New("CheckValidGoSum() depends on yet unreleased repo " + deprs.GoPath())
- }
- }
- // no dependancies error'd out. It should be ok to release this package
- log.Log(REPOWARN, "Releasing this should be ok", r.GoPath())
- return true, nil
-}
-*/
diff --git a/interface.go b/interface.go
deleted file mode 100644
index 3189a5b..0000000
--- a/interface.go
+++ /dev/null
@@ -1,95 +0,0 @@
-package repolist
-
-// attempt to make a golang 'interface' for a 'view' of git repos
-
-import (
- "context"
- "errors"
- "fmt"
-
- "go.wit.com/lib/protobuf/virtbuf"
-)
-
-// ViewRepoManager is a concrete implementation of the RepoManager interface.
-type ViewRepoManager struct {
- // client represents a hypothetical API client for interacting with the cloud.
- client ViewAPIClient
-}
-
-// ViewAPIClient defines the methods required from the API client.
-// This is useful if you want to mock this client for testing.
-type ViewAPIClient interface {
- GetRepoByName(ctx context.Context, name string) (*virtbuf.Cluster, error)
- StartRepo(ctx context.Context, clusterID string) error
- StopRepo(ctx context.Context, clusterID string) error
- ListRepos(ctx context.Context) ([]*virtbuf.Cluster, error)
- GetRepoStatus(ctx context.Context, clusterID string) (string, error)
-}
-
-// NewViewRepoManager creates a new ViewRepoManager with the provided API client.
-func NewViewRepoManager(client ViewAPIClient) *ViewRepoManager {
- return &ViewRepoManager{client: client}
-}
-
-// FindByName retrieves a cluster by name.
-func (m *ViewRepoManager) FindByName(ctx context.Context, name string) (*virtbuf.Cluster, error) {
- cluster, err := m.client.GetRepoByName(ctx, name)
- if err != nil {
- return nil, fmt.Errorf("error finding cluster by name %q: %w", name, err)
- }
- return cluster, nil
-}
-
-// Start initiates the startup process for the specified cluster.
-func (m *ViewRepoManager) Start(ctx context.Context, cluster *virtbuf.Cluster) error {
- if cluster == nil {
- return errors.New("cluster cannot be nil")
- }
- /*
- err := m.client.StartRepo(ctx, cluster.Id)
- if err != nil {
- return fmt.Errorf("error starting cluster %q: %w", cluster.Id, err)
- }
- */
- return nil
-}
-
-// Stop halts the specified cluster.
-func (m *ViewRepoManager) Stop(ctx context.Context, cluster *virtbuf.Cluster) error {
- if cluster == nil {
- return errors.New("cluster cannot be nil")
- }
- /*
- err := m.client.StopRepo(ctx, cluster.Id)
- if err != nil {
- return fmt.Errorf("error stopping cluster %q: %w", cluster.Id, err)
- }
- */
- return nil
-}
-
-// List retrieves all available clusters.
-func (m *ViewRepoManager) List(ctx context.Context) ([]*virtbuf.Cluster, error) {
- /*
- clusters, err := m.client.ListRepos(ctx)
- if err != nil {
- return nil, fmt.Errorf("error listing clusters: %w", err)
- }
- return clusters, nil
- */
- return nil, errors.New("List not done yet")
-}
-
-// Status checks the current status of a specified cluster.
-func (m *ViewRepoManager) Status(ctx context.Context, cluster *virtbuf.Cluster) (string, error) {
- if cluster == nil {
- return "", errors.New("cluster cannot be nil")
- }
- /*
- status, err := m.client.GetRepoStatus(ctx, cluster.Id)
- if err != nil {
- return "", fmt.Errorf("error getting status of cluster %q: %w", cluster.Id, err)
- }
- */
- return "", nil
-}
diff --git a/scanIterator.go b/scanIterator.go
index c780eae..7ceec67 100644
--- a/scanIterator.go
+++ b/scanIterator.go
@@ -104,43 +104,3 @@ func (r *RepoList) selectRepoAll() []*RepoRow {
return repoPointers
}
-
-/*
-// this sort doesn't really work. I think it forgets to sort the last two
-// todo: sort this out. literally
-// SelectRepoPointers safely returns a slice of pointers to Repo records.
-func (r *RepoList) selectUnmergedRepos() []*RepoRow {
- r.RLock()
- defer r.RUnlock()
-
- // Create a new slice to hold pointers to each Repo
- // repoPointers := make([]*Repo, len(c.E.Repos))
- var repoPointers []*RepoRow
- for _, repo := range me.allrepos {
- if repo == nil {
- continue
- }
- if repo.Status == nil {
- continue
- }
- if !repo.Status.InitOk {
- continue
- }
- if repo.ReadOnly() {
- continue
- }
- if repo.State() == "PERFECT" {
- continue
- }
- if repo.Status.Whitelist {
- continue
- }
- if repo.Status.IsReleased() {
- continue
- }
- repoPointers = append(repoPointers, repo) // Copy pointers for safe iteration
- }
-
- return repoPointers
-}
-*/