diff options
| author | Jeff Carr <[email protected]> | 2025-01-30 19:47:48 -0600 | 
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2025-01-30 19:47:48 -0600 | 
| commit | 5f0a271bf767a35370b6fcf078847f9fceba8d7d (patch) | |
| tree | d5918f1bc7b9951b8d356d1b722a903188149ebb | |
| parent | 25fe17d59cd4081ac1204e9686859af773bd69c1 (diff) | |
almost there on a first git am attemptv0.22.66
| -rw-r--r-- | applyPatch.go | 64 | ||||
| -rw-r--r-- | doPatch.go | 8 | ||||
| -rw-r--r-- | windowPatches.go | 1 | 
3 files changed, 48 insertions, 25 deletions
diff --git a/applyPatch.go b/applyPatch.go index bd55cc3..3610c06 100644 --- a/applyPatch.go +++ b/applyPatch.go @@ -7,6 +7,7 @@ import (  	"path/filepath"  	"strings" +	"go.wit.com/lib/gui/shell"  	"go.wit.com/lib/protobuf/forgepb"  	"go.wit.com/lib/protobuf/gitpb"  	"go.wit.com/log" @@ -89,36 +90,49 @@ func applyPatchset(pset *forgepb.Patchset) error {  			log.Info(fullname, "save failed", err)  			continue  		} else { +			basedir, filename := filepath.Split(fullname) +			cmd := []string{"git", "am", filename} +			log.Info("Should run: at", basedir, ":", cmd) +			log.Info(basedir, filename) +			result := shell.PathRun(basedir, cmd)  			/* -				// log.Info("pset filename FILENAME IS REAL?", p.Filename, pset.Name, pset.Comment) -				basepath, filename := filepath.Split(p.Filename) -				fullpath := filepath.Join(me.forge.GetGoSrc(), basepath) -				log.Info("pset filename FILENAME IS REAL? fullpath", fullpath) -				fullTmpdir := filepath.Join(tmpdir, basepath) -				err := os.MkdirAll(fullTmpdir, os.ModePerm)  				if err != nil { -					log.Info("applyPathces() MkdirAll failed for", fullTmpdir) -					log.Info("applyPathces() MkdirAll failed err", err) -					everythingworked = false -					continue -				} -				log.Info("pset filename FILENAME IS REAL? tmp fullTmpdir", fullTmpdir) -				tmpname := filepath.Join(fullTmpdir, filename) -				raw, _ := os.OpenFile(tmpname, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644) -				raw.Write(p.Data) -				raw.Close() -			*/ -			/* -				FIX THIS -				cmd := []string{"git", "am", fullname} -				result := shell.PathRun(fullpath, cmd) -				if result.Exit != 0 { -					log.Info("cmd failed", cmd, result.Exit) -					everythingworked = false +					log.Info("git am failed", err)  				}  			*/ +			for _, line := range result.Stdout { +				log.Warn("stdout:", line) +			} +			for _, line := range result.Stderr { +				log.Warn("stderr:", line) +			}  		} -		// until 'git am' works +		/* +			// log.Info("pset filename FILENAME IS REAL?", p.Filename, pset.Name, pset.Comment) +			basepath, filename := filepath.Split(p.Filename) +			fullpath := filepath.Join(me.forge.GetGoSrc(), basepath) +			log.Info("pset filename FILENAME IS REAL? fullpath", fullpath) +			fullTmpdir := filepath.Join(tmpdir, basepath) +			err := os.MkdirAll(fullTmpdir, os.ModePerm) +			if err != nil { +				log.Info("applyPathces() MkdirAll failed for", fullTmpdir) +				log.Info("applyPathces() MkdirAll failed err", err) +				everythingworked = false +				continue +			} +			log.Info("pset filename FILENAME IS REAL? tmp fullTmpdir", fullTmpdir) +			tmpname := filepath.Join(fullTmpdir, filename) +			raw, _ := os.OpenFile(tmpname, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644) +			raw.Write(p.Data) +			raw.Close() +		*/ +		/* +			result := shell.PathRun(fullpath, cmd) +			if result.Exit != 0 { +				log.Info("cmd failed", cmd, result.Exit) +				everythingworked = false +			} +		*/  		everythingworked = false  	}  	if everythingworked { @@ -161,5 +161,13 @@ func doPatchGet() error {  		return err  	}  	log.Info("Got Patchsets ok", psets.Uuid) + +	log.Info("got psets len", len(psets.Patchsets)) +	all := psets.SortByName() +	for all.Scan() { +		pset := all.Next() +		// log.Info("pset name =", pset.Name) +		dumpPatchset(pset) +	}  	return nil  } diff --git a/windowPatches.go b/windowPatches.go index 423aae5..1bdc755 100644 --- a/windowPatches.go +++ b/windowPatches.go @@ -154,6 +154,7 @@ func (r *patchesWindow) addPatchsetNew(pset *forgepb.Patchset) {  	r.psetgrid.NewLabel(pset.Name)  	r.psetgrid.NewLabel(pset.Comment)  	r.psetgrid.NewLabel(pset.GitAuthorName) +	// r.psetgrid.NewLabel(pset.RepoNamespace)  	if pset.State == "BROKEN" {  		r.psetgrid.NewLabel("Bad")  	} else {  | 
