Compare commits
No commits in common. "master" and "v0.25.4" have entirely different histories.
6
Makefile
6
Makefile
|
@ -6,10 +6,8 @@ BUILDTIME = $(shell date +%Y.%m.%d_%H%M)
|
|||
# make gocui # try the ncurses gui plugin
|
||||
# make andlabs # try the andlabs gui plugin (uses GTK)
|
||||
|
||||
default: install-verbose tag
|
||||
|
||||
tag:
|
||||
forge tag list
|
||||
default: install-verbose
|
||||
FORGE_VERBOSE=true forge list |head -n 20
|
||||
|
||||
vet:
|
||||
@GO111MODULE=off go vet
|
||||
|
|
|
@ -12,6 +12,39 @@ func savePatchset(pset *forgepb.Patchset) error {
|
|||
log.Info("savePatches() GIT_AUTHOR_EMAIL", pset.GetGitAuthorEmail())
|
||||
log.Info("savePatches() Branch Name", pset.GetStartBranchName())
|
||||
log.Info("savePatches() Start Hash", pset.GetStartBranchHash())
|
||||
|
||||
var count int
|
||||
var bad int
|
||||
var lasterr error
|
||||
all := pset.Patches.SortByFilename()
|
||||
for all.Scan() {
|
||||
p := all.Next()
|
||||
basedir := filepath.Join(os.Getenv("FORGE_CONFIG"), "currentpatches")
|
||||
if fullname, err := savePatchFile(p, basedir); err != nil {
|
||||
log.Info(fullname, "save failed", err)
|
||||
bad += 1
|
||||
lasterr = err
|
||||
}
|
||||
count += 1
|
||||
}
|
||||
log.Info("pset has", count, "total patches, ", bad, "bad save patches")
|
||||
if bad == 0 {
|
||||
return lasterr
|
||||
}
|
||||
return nil
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
// re-run git CheckDirty() on everything
|
||||
func IsAnythingDirty() bool {
|
||||
doCheckDirtyAndConfigSave()
|
||||
found := me.forge.FindDirty()
|
||||
if found.Len() == 0 {
|
||||
return false
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
@ -29,6 +62,43 @@ func countCurrentPatches(repo *gitpb.Repo) int {
|
|||
return len(result.Stdout)
|
||||
}
|
||||
|
||||
func savePatchFile(p *forgepb.Patch, basedir string) (string, error) {
|
||||
basepath, filename := filepath.Split(p.Filename)
|
||||
fulldir := filepath.Join(basedir, basepath)
|
||||
err := os.MkdirAll(fulldir, os.ModePerm)
|
||||
if err != nil {
|
||||
log.Info("applyPathces() MkdirAll failed for", fulldir)
|
||||
log.Info("applyPathces() MkdirAll failed err", err)
|
||||
return "", err
|
||||
}
|
||||
tmpname := filepath.Join(fulldir, filename)
|
||||
log.Info("pset filename FILENAME IS REAL?", tmpname)
|
||||
raw, _ := os.OpenFile(tmpname, os.O_WRONLY|os.O_CREATE|os.O_TRUNC, 0644)
|
||||
raw.Write(p.Data)
|
||||
raw.Close()
|
||||
return tmpname, nil
|
||||
}
|
||||
|
||||
func readPatchFile(pbfile string) (*forgepb.Patchset, error) {
|
||||
bytes, err := os.ReadFile(pbfile)
|
||||
if err != nil {
|
||||
log.Info("readfile error", pbfile, err)
|
||||
return nil, err
|
||||
}
|
||||
return handleBytes(bytes)
|
||||
}
|
||||
|
||||
func handleBytes(bytes []byte) (*forgepb.Patchset, error) {
|
||||
var pset *forgepb.Patchset
|
||||
pset = new(forgepb.Patchset)
|
||||
err := pset.Unmarshal(bytes)
|
||||
if err != nil {
|
||||
log.Info("Unmarshal failed", err)
|
||||
return nil, err
|
||||
}
|
||||
return pset, nil
|
||||
}
|
||||
|
||||
func doRegister(newurl string) error {
|
||||
var url string
|
||||
url = me.urlbase + "/register?url=" + newurl
|
||||
|
|
60
argv.go
60
argv.go
|
@ -6,8 +6,6 @@ package main
|
|||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
|
||||
"go.wit.com/lib/gui/prep"
|
||||
)
|
||||
|
||||
/*
|
||||
|
@ -149,49 +147,63 @@ forge -- a tool to manage lots of git repos. forge includes a GUI and TUI.
|
|||
`
|
||||
}
|
||||
|
||||
//
|
||||
// handles shell autocomplete
|
||||
func DoAutoComplete(pb *prep.Auto) {
|
||||
switch pb.Cmd {
|
||||
//
|
||||
|
||||
func DoAutoComplete(argv []string) {
|
||||
switch argv[0] {
|
||||
case "checkout":
|
||||
pb.Autocomplete2("devel master user")
|
||||
fmt.Println("devel master user")
|
||||
case "clean":
|
||||
pb.Autocomplete2("")
|
||||
// me.pp.WriteHelp(os.Stderr)
|
||||
// me.pp.WriteUsageForSubcommand(os.Stderr, me.pp.SubcommandNames()...)
|
||||
// me.pp.WriteHelpForSubcommand(os.Stderr, me.pp.SubcommandNames()...)
|
||||
// me.pp.WriteHelpForSubcommand(os.Stderr, "clean")
|
||||
fmt.Println("--force verify --repo")
|
||||
case "commit":
|
||||
pb.Autocomplete2("--all")
|
||||
fmt.Println("--all")
|
||||
case "config":
|
||||
fmt.Println("add fix list")
|
||||
case "dirty":
|
||||
fmt.Println("")
|
||||
case "gui":
|
||||
fmt.Println("")
|
||||
case "--gui":
|
||||
pb.Autocomplete2("andlabs gocui")
|
||||
if ifBlank(argv[1]) {
|
||||
fmt.Fprintln(os.Stderr, "")
|
||||
fmt.Fprintln(os.Stderr, "CUI: terminal interface using 'gocui'")
|
||||
fmt.Fprintln(os.Stderr, "GUI: linux and macos GUI using GTK")
|
||||
} else {
|
||||
fmt.Println("CUI GUI")
|
||||
}
|
||||
case "list":
|
||||
pb.Autocomplete2("--mine --favorites --dirty")
|
||||
fmt.Println("--mine --favorites --dirty")
|
||||
case "merge":
|
||||
pb.Autocomplete2("devel master --all")
|
||||
fmt.Println("devel master")
|
||||
case "normal":
|
||||
pb.Autocomplete2("on off")
|
||||
fmt.Println("on off")
|
||||
case "pull":
|
||||
pb.Autocomplete2("--force check")
|
||||
fmt.Println("--force check")
|
||||
case "patch":
|
||||
fmt.Println("check get list repos submit show")
|
||||
case "user":
|
||||
fmt.Println("--force")
|
||||
case "devel":
|
||||
fmt.Println("--force")
|
||||
case "master":
|
||||
fmt.Println("")
|
||||
case "verify":
|
||||
fmt.Println("user devel master")
|
||||
case "tag":
|
||||
fmt.Println("list --delete clean")
|
||||
default:
|
||||
if pb.Cmd == "" {
|
||||
pb.Autocomplete2("help list checkout clean commit dirty fetch gui normal merge patch pull tag --gui")
|
||||
} else {
|
||||
pb.Autocomplete2("list checkout clean commit dirty normal merge tag")
|
||||
if argv[0] == ARGNAME {
|
||||
// list the subcommands here
|
||||
fmt.Println("help list checkout clean commit dirty fetch gui normal merge patch pull tag")
|
||||
}
|
||||
}
|
||||
os.Exit(0)
|
||||
}
|
||||
|
||||
func (args) Appname() string {
|
||||
return ARGNAME
|
||||
}
|
||||
|
||||
func ifBlank(arg string) bool {
|
||||
if arg == "''" {
|
||||
// if empty, the user has not typed something
|
||||
|
@ -200,6 +212,6 @@ func ifBlank(arg string) bool {
|
|||
return false
|
||||
}
|
||||
|
||||
func (a args) DoAutoComplete(autoArgv *prep.Auto) {
|
||||
DoAutoComplete(autoArgv)
|
||||
func (a args) DoAutoComplete(argv []string) {
|
||||
DoAutoComplete(argv)
|
||||
}
|
||||
|
|
37
config.go
37
config.go
|
@ -6,24 +6,43 @@ package main
|
|||
import (
|
||||
"fmt"
|
||||
|
||||
"go.wit.com/lib/config"
|
||||
"go.wit.com/lib/protobuf/forgepb"
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
func forgeConfigSave() error {
|
||||
return me.forge.Config.ConfigSave()
|
||||
}
|
||||
|
||||
func setForgeMode(fmode forgepb.ForgeMode) {
|
||||
if me.forge.Config.Mode == fmode {
|
||||
return
|
||||
/*
|
||||
func configInit() (*forgepb.ForgeConfigs, error) {
|
||||
me.urlbase = argv.URL
|
||||
if me.urlbase == "" {
|
||||
me.urlbase = "https://go.wit.com/"
|
||||
}
|
||||
log.Info("changing mode", me.forge.Config.Mode, fmode)
|
||||
me.forge.Config.Mode = fmode
|
||||
config.SetChanged("forge", true)
|
||||
me.forge.Config.ConfigSave()
|
||||
if os.Getenv("FORGE_URL") != "" {
|
||||
me.urlbase = os.Getenv("FORGE_URL")
|
||||
log.Info("got forge url", me.urlbase)
|
||||
}
|
||||
me.urlbase = strings.Trim(me.urlbase, "/") // track down why trailing '/' makes http POST not work
|
||||
|
||||
configs := new(forgepb.ForgeConfigs)
|
||||
err := config.ConfigLoad(configs, ARGNAME, "forge")
|
||||
if errors.Is(err, os.ErrNotExist) {
|
||||
// if forgepb.FirstTimeUser() {
|
||||
log.Info("You are running forge for the first time here")
|
||||
// }
|
||||
configs.ReposDir = "/home/forge"
|
||||
configs.ReposPB = "/home/forge/repos.pb"
|
||||
configs.PatchDir = "/var/lib/forged"
|
||||
if err := forgeConfigSave(); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
log.Info("WARNING: made a new default config file here", configs.Filename)
|
||||
okExit("")
|
||||
}
|
||||
return configs, err
|
||||
}
|
||||
*/
|
||||
|
||||
func sampleConfig(all *forgepb.ForgeConfigs) {
|
||||
new1 := new(forgepb.ForgeConfig)
|
||||
|
|
|
@ -8,7 +8,6 @@ import (
|
|||
"time"
|
||||
|
||||
"go.wit.com/lib/gui/shell"
|
||||
"go.wit.com/lib/protobuf/forgepb"
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
|
@ -27,7 +26,6 @@ func doCheckout() error {
|
|||
}
|
||||
|
||||
if argv.Checkout.Devel != nil {
|
||||
// setForgeMode(forgepb.ForgeMode_DEVEL)
|
||||
if err := me.forge.DoAllCheckoutDevelNew(argv.Force); err != nil {
|
||||
badExit(err)
|
||||
}
|
||||
|
@ -35,8 +33,6 @@ func doCheckout() error {
|
|||
}
|
||||
|
||||
if argv.Checkout.Master != nil {
|
||||
setForgeMode(forgepb.ForgeMode_MASTER) // disable "normal" mode if set
|
||||
|
||||
if err := me.forge.DoAllCheckoutMaster(); err != nil {
|
||||
badExit(err)
|
||||
}
|
||||
|
|
12
doClean.go
12
doClean.go
|
@ -20,11 +20,15 @@ func checkRemoteBranches(repo *gitpb.Repo) error {
|
|||
}
|
||||
if repo.VerifyRemoteAndLocalBranches(repo.GetDevelBranchName()) {
|
||||
} else {
|
||||
return log.Errorf("remote devel is out of sync with local: todo: git pull or git fetch")
|
||||
repo.Reload()
|
||||
me.forge.SetConfigSave(true)
|
||||
return log.Errorf("remote devel is out of sync with local")
|
||||
}
|
||||
if repo.VerifyRemoteAndLocalBranches(repo.GetMasterBranchName()) {
|
||||
} else {
|
||||
return log.Errorf("remote master is out of sync with local: todo: git pull or git fetch")
|
||||
repo.Reload()
|
||||
me.forge.SetConfigSave(true)
|
||||
return log.Errorf("remote master is out of sync with local")
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
@ -32,7 +36,7 @@ func checkRemoteBranches(repo *gitpb.Repo) error {
|
|||
// reverts all repos back to the original master branches
|
||||
// automatically deletes local devel and user branches
|
||||
func doClean() error {
|
||||
setForgeMode(forgepb.ForgeMode_CLEAN)
|
||||
me.forge.Config.Mode = forgepb.ForgeMode_CLEAN
|
||||
|
||||
if argv.Clean.Verify != nil {
|
||||
stats := me.forge.RillRepos(checkRemoteBranches)
|
||||
|
@ -249,7 +253,7 @@ func justDeleteTheDevelBranchAlready(repo *gitpb.Repo) error {
|
|||
return err
|
||||
}
|
||||
cmd := []string{"git", "merge something somehow"}
|
||||
log.Info("devel local, remote and master branches are wrong", repo.GetGoPath(), cmd, b1)
|
||||
log.Info("DEVEL LOCAL NEEDS GIT MERGE TO MASTER", repo.GetGoPath(), cmd, b1)
|
||||
// _, err := repo.RunVerbose(cmd)
|
||||
return nil
|
||||
}
|
||||
|
|
13
doCommit.go
13
doCommit.go
|
@ -6,7 +6,6 @@ package main
|
|||
import (
|
||||
"os"
|
||||
|
||||
"go.wit.com/lib/config"
|
||||
"go.wit.com/lib/gui/shell"
|
||||
"go.wit.com/lib/protobuf/gitpb"
|
||||
"go.wit.com/log"
|
||||
|
@ -22,16 +21,22 @@ func doCommit() error {
|
|||
badExit(err)
|
||||
}
|
||||
newpatches = true
|
||||
repo.CheckDirty()
|
||||
}
|
||||
if !argv.Commit.Submit {
|
||||
okExit("")
|
||||
}
|
||||
if newpatches {
|
||||
config.SetChanged("repos", true)
|
||||
return doPatchSubmit()
|
||||
}
|
||||
okExit("")
|
||||
}
|
||||
|
||||
repo := findCurrentPwdRepoOrDie()
|
||||
pwd, _ := os.Getwd()
|
||||
repo := me.forge.Repos.FindByFullPath(pwd)
|
||||
if repo == nil {
|
||||
log.Info("todo: forge doesn't know how to work here yet")
|
||||
okExit("")
|
||||
}
|
||||
|
||||
if !repo.CheckDirty() {
|
||||
okExit(log.Sprintf("this repo %s is not dirty.\n\n--all # commit all changes in all repos", repo.GetFullPath()))
|
||||
|
|
|
@ -55,6 +55,7 @@ func doConfig() {
|
|||
}
|
||||
|
||||
log.Info("config.PathLock =", me.forge.Config.PathLock)
|
||||
log.Info("config.GoSrc =", me.forge.Config.GoSrc)
|
||||
|
||||
me.forge.ConfigPrintTable()
|
||||
okExit("")
|
||||
|
|
84
doMerge.go
84
doMerge.go
|
@ -4,61 +4,11 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
"go.wit.com/lib/config"
|
||||
"go.wit.com/lib/gui/shell"
|
||||
"go.wit.com/lib/protobuf/forgepb"
|
||||
"go.wit.com/lib/protobuf/gitpb"
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
func doMerge() error {
|
||||
if argv.All == true {
|
||||
start := time.Now()
|
||||
repos, err := doMergeDevel()
|
||||
dur := time.Since(start)
|
||||
if err != nil {
|
||||
badExit(err)
|
||||
}
|
||||
log.Printf("Merged %d devel branches in %s\n", repos.Len(), shell.FormatDuration(dur))
|
||||
|
||||
start = time.Now()
|
||||
repos, err = doMergeMaster()
|
||||
dur = time.Since(start)
|
||||
if err != nil {
|
||||
badExit(err)
|
||||
}
|
||||
log.Printf("Merged %d master branches in %s\n", repos.Len(), shell.FormatDuration(dur))
|
||||
okExit("")
|
||||
}
|
||||
if argv.Merge.Devel != nil {
|
||||
start := time.Now()
|
||||
repos, err := doMergeDevel()
|
||||
dur := time.Since(start)
|
||||
if err != nil {
|
||||
badExit(err)
|
||||
}
|
||||
log.Printf("Merged %d devel branches in %s\n", repos.Len(), shell.FormatDuration(dur))
|
||||
okExit("")
|
||||
}
|
||||
if argv.Merge.Master != nil {
|
||||
start := time.Now()
|
||||
repos, err := doMergeMaster()
|
||||
dur := time.Since(start)
|
||||
if err != nil {
|
||||
badExit(err)
|
||||
}
|
||||
log.Printf("Merged %d master branches in %s\n", repos.Len(), shell.FormatDuration(dur))
|
||||
okExit("")
|
||||
}
|
||||
repo := findCurrentPwdRepoOrDie()
|
||||
if err := repoMergeToDevel(repo); err != nil {
|
||||
badRepoExit(repo, err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func doMergeReport() *forgepb.Patches {
|
||||
found := forgepb.NewPatches()
|
||||
for repo := range me.forge.Repos.IterAll() {
|
||||
|
@ -81,7 +31,7 @@ func doMergeDevel() (*gitpb.Repos, error) {
|
|||
found := findMergeToDevel()
|
||||
for repo := range found.IterAll() {
|
||||
if repo.CheckDirty() {
|
||||
log.Info("repo is dirty", repo.GetFullPath())
|
||||
log.Info("repo is dirty", repo.GetGoPath())
|
||||
continue
|
||||
}
|
||||
log.Infof("%s starting git merge\n", repo.FullPath)
|
||||
|
@ -103,41 +53,14 @@ func doMergeDevel() (*gitpb.Repos, error) {
|
|||
badExit(err)
|
||||
}
|
||||
done.Append(repo)
|
||||
config.SetChanged("repos", true)
|
||||
}
|
||||
return done, err
|
||||
}
|
||||
|
||||
func repoMergeToDevel(repo *gitpb.Repo) error {
|
||||
if repo.CheckDirty() {
|
||||
return log.Errorf("can not merge. repo is dirty")
|
||||
}
|
||||
log.Infof("%s starting git merge\n", repo.FullPath)
|
||||
if repo.CheckoutDevel() {
|
||||
log.Info("checkout devel failed", repo.GetGoPath())
|
||||
err := log.Errorf("checkout devel failed")
|
||||
badExit(err)
|
||||
}
|
||||
// hash differences when merging user into devel branch
|
||||
out := repo.GetBranchDifferences(repo.GetDevelBranchName(), repo.GetUserBranchName())
|
||||
for i, hash := range out {
|
||||
log.Info("MERGE HASH FROM USER TO DEVEL", i, hash)
|
||||
}
|
||||
if _, err := repo.MergeToDevel(); err != nil {
|
||||
log.Info("merge from user failed", repo.GetGoPath(), err)
|
||||
// err := log.Errorf("merge from user failed")
|
||||
// log.Info(strings.Join(r.Stdout, "\n"))
|
||||
// log.Info(strings.Join(r.Stderr, "\n"))
|
||||
badExit(err)
|
||||
}
|
||||
config.SetChanged("repos", true)
|
||||
return nil
|
||||
}
|
||||
|
||||
func doMergeMaster() (*gitpb.Repos, error) {
|
||||
var err error
|
||||
setForgeMode(forgepb.ForgeMode_MASTER)
|
||||
|
||||
me.forge.Config.Mode = forgepb.ForgeMode_MASTER // disable "normal" mode if set
|
||||
configSave = true
|
||||
done := gitpb.NewRepos()
|
||||
found := findMergeToMaster()
|
||||
for repo := range found.IterAll() {
|
||||
|
@ -162,7 +85,6 @@ func doMergeMaster() (*gitpb.Repos, error) {
|
|||
}
|
||||
|
||||
done.Append(repo)
|
||||
config.SetChanged("repos", true)
|
||||
}
|
||||
return done, err
|
||||
}
|
||||
|
|
55
doNormal.go
55
doNormal.go
|
@ -6,11 +6,8 @@ package main
|
|||
// checks that repos are in a "normal" state
|
||||
|
||||
import (
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"go.wit.com/lib/config"
|
||||
"go.wit.com/lib/gui/shell"
|
||||
"go.wit.com/lib/protobuf/gitpb"
|
||||
"go.wit.com/log"
|
||||
|
@ -38,7 +35,7 @@ func doNormal() bool {
|
|||
log.Info("Some repos are not in a 'normal' state. error count =", count)
|
||||
log.Info("TODO: list the repos here. forge patch repos?")
|
||||
dumpWorkRepos()
|
||||
config.SetChanged("repos", true)
|
||||
configSave = true
|
||||
return false
|
||||
}
|
||||
return true
|
||||
|
@ -50,46 +47,19 @@ func doNormal() bool {
|
|||
// this needs to run each time in case repos were added manually by the user
|
||||
// this also verifies that
|
||||
func checkNormalRepoState(repo *gitpb.Repo) error {
|
||||
var err error
|
||||
tmp := filepath.Join(me.forge.Config.ReposDir, repo.GetNamespace())
|
||||
if tmp != repo.FullPath {
|
||||
log.Infof("%s != %s\n", repo.FullPath, tmp)
|
||||
if strings.HasPrefix(repo.FullPath, me.forge.Config.ReposDir) {
|
||||
tmp = strings.TrimPrefix(repo.FullPath, me.forge.Config.ReposDir)
|
||||
tmp = strings.Trim(tmp, "/")
|
||||
repo.Namespace = tmp
|
||||
err = log.Errorf("namespace set to filepath")
|
||||
}
|
||||
} else {
|
||||
// log.Infof("%s == %s\n", repo.FullPath, tmp)
|
||||
}
|
||||
|
||||
tmp = strings.Trim(repo.Namespace, "/")
|
||||
if tmp != repo.Namespace {
|
||||
err = log.Errorf("junk in ns %s", repo.Namespace)
|
||||
repo.Namespace = tmp
|
||||
}
|
||||
|
||||
if repo.GetMasterBranchName() == "" {
|
||||
me.forge.VerifyBranchNames(repo)
|
||||
configSave = true
|
||||
log.Info("ABNORMAL: master branch name was blank in", repo.GetFullPath())
|
||||
}
|
||||
if repo.GetMasterBranchName() == "" {
|
||||
me.forge.VerifyBranchNames(repo)
|
||||
err = log.Errorf("master branch name blank")
|
||||
return log.Errorf("master branch name blank")
|
||||
}
|
||||
if repo.GetDevelBranchName() == "" {
|
||||
me.forge.VerifyBranchNames(repo)
|
||||
err = log.Errorf("devel branch name blank")
|
||||
return log.Errorf("devel branch name blank")
|
||||
}
|
||||
if repo.GetUserBranchName() == "" {
|
||||
me.forge.VerifyBranchNames(repo)
|
||||
err = log.Errorf("user branch name blank")
|
||||
}
|
||||
if repo.GetGoPath() == repo.GetNamespace() {
|
||||
// log.Info(repo.FullPath, "gopath == namespace", repo.GetGoPath(), repo.GetNamespace())
|
||||
} else {
|
||||
log.Info(repo.FullPath, "gopath != namespace", repo.GetGoPath(), repo.GetNamespace())
|
||||
return log.Errorf("user branch name blank")
|
||||
}
|
||||
repo.MakeLocalDevelBranch()
|
||||
|
||||
|
@ -97,16 +67,11 @@ func checkNormalRepoState(repo *gitpb.Repo) error {
|
|||
repo.VerifyRemoteAndLocalBranches(repo.GetMasterBranchName())
|
||||
|
||||
if repo.GetCurrentBranchName() != repo.GetUserBranchName() {
|
||||
log.Infof("changing to user(%s) branch: %s\n", repo.GetUserBranchName(), repo.FullPath)
|
||||
configSave = true
|
||||
log.Info("changing to user branch", repo.FullPath)
|
||||
repo.CheckoutUser()
|
||||
repo.ReloadCheck()
|
||||
err = log.Errorf("now on user branch")
|
||||
repo.Reload()
|
||||
return log.Errorf("now on user branch")
|
||||
}
|
||||
|
||||
if me.forge.Config.IsReadOnly(repo.GetGoPath()) != repo.GetReadOnly() {
|
||||
repo.ReadOnly = me.forge.Config.IsReadOnly(repo.GetGoPath())
|
||||
log.Info("damnit", repo.FullPath)
|
||||
err = log.Errorf("readonly bit wrong")
|
||||
}
|
||||
return err
|
||||
return nil
|
||||
}
|
||||
|
|
69
doPatch.go
69
doPatch.go
|
@ -45,16 +45,7 @@ func doPatchSubmit() error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
if pset.Patches == nil {
|
||||
log.Info("pset.Patches == nil")
|
||||
return err
|
||||
}
|
||||
if pset.Patches.Len() == 0 {
|
||||
log.Info("did not find any patches")
|
||||
return nil
|
||||
}
|
||||
pset.PrintTable()
|
||||
_, _, err = pset.HttpPost(myServer(), "new")
|
||||
_, _, err = pset.Patches.HttpPostVerbose(myServer(), "new")
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -73,7 +64,7 @@ func doPatch() error {
|
|||
}
|
||||
|
||||
if argv.Patch.Get != nil {
|
||||
psets := forgepb.NewSets()
|
||||
psets := forgepb.NewPatchsets()
|
||||
newpb, _, _ := psets.HttpPostVerbose(myServer(), "get")
|
||||
newpb.PrintTable()
|
||||
me.forge.Patchsets = newpb
|
||||
|
@ -101,40 +92,38 @@ func doPatch() error {
|
|||
|
||||
if argv.Patch.List != nil {
|
||||
var changed bool
|
||||
newpatches := new(forgepb.Set)
|
||||
newpatches.Patches = forgepb.NewPatches()
|
||||
newpatches := forgepb.NewPatches()
|
||||
for pset := range me.forge.Patchsets.IterAll() {
|
||||
pset.PrintTable()
|
||||
log.Info(pset.Uuid)
|
||||
for patch := range pset.Patches.IterAll() {
|
||||
if setNewCommitHash(patch) {
|
||||
changed = true
|
||||
if patch.NewHash == "" || patch.NewHash == "na" {
|
||||
if newpatches.Patches.AppendByPatchId(patch) {
|
||||
log.Info("patchId added here", patch.PatchId)
|
||||
}
|
||||
if patch.NewHash == "na" {
|
||||
newpatches.Append(patch)
|
||||
log.Info("apply this patch?")
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
for patch := range pset.Patches.IterAll() {
|
||||
if repo, ok := me.forge.IsPatchApplied(patch); ok {
|
||||
log.Info("\tfound patch in repo", repo.Namespace, patch.Filename)
|
||||
} else {
|
||||
log.Info("patchId already here", patch.PatchId)
|
||||
}
|
||||
} else {
|
||||
if err := setNewCommitHash(patch); err != nil {
|
||||
log.Infof("%s bad check on patch failure %v\n", patch.Filename, err)
|
||||
return err
|
||||
}
|
||||
log.Info("newhash set already here", patch.PatchId, patch.NewHash)
|
||||
log.Info("\tdid not find patch", patch.CommitHash, patch.NewHash, patch.Filename)
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
if changed {
|
||||
if err := me.forge.SavePatchsets(); err != nil {
|
||||
log.Warn("savePatchsets() failed", err)
|
||||
}
|
||||
}
|
||||
log.Info("NEW PATCHES TABLE")
|
||||
newpatches.PrintTable()
|
||||
for patch := range newpatches.Patches.IterAll() {
|
||||
if err := setNewCommitHash(patch); err == nil {
|
||||
log.Info("newhash set already here", patch.PatchId, patch.NewHash)
|
||||
continue
|
||||
}
|
||||
log.Infof("%s is new\n", patch.Filename)
|
||||
me.forge.Patchsets.PrintTable()
|
||||
if newpatches.Len() != 0 {
|
||||
for patch := range newpatches.IterAll() {
|
||||
log.Info("new patch:", patch.CommitHash, patch.NewHash, patch.Filename)
|
||||
repo := me.forge.FindByGoPath(patch.Namespace)
|
||||
if repo == nil {
|
||||
log.Info("\tCould not find namespace:", patch.Namespace)
|
||||
|
@ -145,17 +134,6 @@ func doPatch() error {
|
|||
log.Info("apply results:", newhash, err)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
/*
|
||||
if newpatches.Len() != 0 {
|
||||
for patch := range newpatches.IterAll() {
|
||||
log.Info("new patch:", patch.CommitHash, patch.NewHash, patch.Filename)
|
||||
repo := me.forge.FindByGoPath(patch.Namespace)
|
||||
if repo == nil {
|
||||
log.Info("\tCould not find namespace:", patch.Namespace)
|
||||
continue
|
||||
}
|
||||
}
|
||||
return log.Errorf("patches need to be applied")
|
||||
}
|
||||
|
||||
|
@ -174,7 +152,6 @@ func doPatch() error {
|
|||
}
|
||||
newpb.PrintTable()
|
||||
return nil
|
||||
*/
|
||||
}
|
||||
|
||||
// if nothing, show patches & dirty repos
|
||||
|
@ -207,7 +184,7 @@ func dumpWorkRepos() bool {
|
|||
|
||||
// returns bad if patches can not be applied
|
||||
// logic is not great here but it was a first pass
|
||||
func dumpPatchset(pset *forgepb.Set) bool {
|
||||
func dumpPatchset(pset *forgepb.Patchset) bool {
|
||||
// don't even bother to continue if we already know it's broken
|
||||
if pset.State == "BROKEN" {
|
||||
log.Printf("Patchset Name: %-24s Author: %s <%s> IS BAD\n", pset.Name, pset.GetGitAuthorName(), pset.GetGitAuthorEmail())
|
||||
|
|
82
doTag.go
82
doTag.go
|
@ -7,7 +7,6 @@ package main
|
|||
|
||||
import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"time"
|
||||
|
||||
"go.wit.com/lib/fhelp"
|
||||
|
@ -24,31 +23,15 @@ func FindRepoByFullPath(wd string) *gitpb.Repo {
|
|||
return nil
|
||||
}
|
||||
|
||||
func findCurrentPwdRepoOrDie() *gitpb.Repo {
|
||||
wd, err := os.Getwd()
|
||||
repo := FindRepoByFullPath(wd)
|
||||
if repo == nil {
|
||||
log.Info("Could not find repo:", wd)
|
||||
badExit(err)
|
||||
}
|
||||
return repo
|
||||
}
|
||||
|
||||
func doTag() error {
|
||||
wd, _ := os.Getwd()
|
||||
if argv.Tag.List != nil {
|
||||
repo := findCurrentPwdRepoOrDie()
|
||||
|
||||
tagTablePB := makeTagTablePB(repo, repo.Tags)
|
||||
// tbox := win.Bottom.Box().SetProgName("TBOX")
|
||||
// t.SetParent(tbox)
|
||||
tagTablePB.MakeTable()
|
||||
tagTablePB.PrintTable()
|
||||
log.Info("list tags here", repo.Namespace)
|
||||
log.Info("list tags here")
|
||||
return nil
|
||||
}
|
||||
|
||||
if argv.Tag.Delete != "" {
|
||||
wd, _ := os.Getwd()
|
||||
|
||||
repo := FindRepoByFullPath(wd)
|
||||
if repo == nil {
|
||||
log.Info("Could not find repo:", wd)
|
||||
|
@ -56,15 +39,13 @@ func doTag() error {
|
|||
}
|
||||
|
||||
// check if the git tag already exists somehow
|
||||
/*
|
||||
testtag := argv.Tag.Delete
|
||||
if !repo.LocalTagExists(testtag) {
|
||||
log.Info("Tag", testtag, "does not exist")
|
||||
return log.Errorf("%s TAG DOES NOT EXIST %s", repo.FullPath, testtag)
|
||||
}
|
||||
*/
|
||||
testtag := argv.Tag.Delete
|
||||
if !argv.Force {
|
||||
if !fhelp.QuestionUser(log.Sprintf("delete tag '%s'?", testtag)) {
|
||||
if !fhelp.QuestionUser("delete this tag?") {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
@ -76,50 +57,37 @@ func doTag() error {
|
|||
return nil
|
||||
}
|
||||
|
||||
ns := "go.wit.com/apps/forge"
|
||||
repo := me.forge.Repos.FindByNamespace(ns)
|
||||
if repo == nil {
|
||||
return log.Errorf("could not find %s", ns)
|
||||
}
|
||||
|
||||
tagTablePB := makeTagTablePB(repo.Tags)
|
||||
// tbox := win.Bottom.Box().SetProgName("TBOX")
|
||||
// t.SetParent(tbox)
|
||||
tagTablePB.MakeTable()
|
||||
tagTablePB.PrintTable()
|
||||
|
||||
log.Info("do other tag stuff here")
|
||||
return nil
|
||||
}
|
||||
|
||||
func makeTagTablePB(repo *gitpb.Repo, pb *gitpb.GitTags) *gitpb.GitTagsTable {
|
||||
func makeTagTablePB(pb *gitpb.GitTags) *gitpb.GitTagsTable {
|
||||
t := pb.NewTable("tagList")
|
||||
t.NewUuid()
|
||||
|
||||
col := t.AddHash()
|
||||
col.Width = 12
|
||||
|
||||
col = t.AddStringFunc("bashash", func(tag *gitpb.GitTag) string {
|
||||
_, base := filepath.Split(tag.Refname)
|
||||
cmd, err := repo.RunStrict([]string{"git", "log", "-1", base, "--format=%H"})
|
||||
if err != nil {
|
||||
return "err"
|
||||
}
|
||||
if len(cmd.Stdout) == 0 {
|
||||
return ""
|
||||
}
|
||||
return cmd.Stdout[0]
|
||||
sf := t.AddStringFunc("Ref Name", func(r *gitpb.GitTag) string {
|
||||
return r.GetRefname()
|
||||
})
|
||||
col.Width = 12
|
||||
sf.Width = 16
|
||||
|
||||
col = t.AddTimeFunc("ctime", func(tag *gitpb.GitTag) time.Time {
|
||||
// todo
|
||||
return tag.Creatordate.AsTime()
|
||||
})
|
||||
col.Width = 4
|
||||
|
||||
col = t.AddTimeFunc("age", func(repo *gitpb.GitTag) time.Time {
|
||||
colAge := t.AddTimeFunc("age", func(repo *gitpb.GitTag) time.Time {
|
||||
// todo
|
||||
return time.Now()
|
||||
})
|
||||
col.Width = 4
|
||||
|
||||
col = t.AddStringFunc("Ref Name", func(r *gitpb.GitTag) string {
|
||||
_, ref := filepath.Split(r.GetRefname())
|
||||
return ref
|
||||
})
|
||||
col.Width = 16
|
||||
|
||||
col = t.AddSubject()
|
||||
col.Width = -1
|
||||
|
||||
t.AddHash()
|
||||
t.AddSubject()
|
||||
colAge.Width = 4
|
||||
return t
|
||||
}
|
||||
|
|
19
doc.go
19
doc.go
|
@ -3,14 +3,20 @@ forge -- a tool to manage lots of git repos. forge includes a GUI and TUI.
|
|||
|
||||
forge only executes the 'git' command. Everything it does, you can run by hand with 'git'.
|
||||
|
||||
forge v0.22.138-6-gaea7f16 Built on 2025.09.03_1935
|
||||
Usage: forge [--debugger] [--logger] [--no-gui] [--gui GUI] [--gui-file GUI-FILE] [--gui-build] [--gui-verbose] [--gui-check-plugin GUI-CHECK-PLUGIN] [--connect CONNECT] [--all] [--build BUILD] [--install INSTALL] [--forge-rebuild] [--force] [--verbose] [--bash] [--auto-complete AUTO-COMPLETE] <command> [<args>]
|
||||
|
||||
Options:
|
||||
|
||||
--debugger open the debugger window
|
||||
--logger open the log.* control window
|
||||
--gui GUI select the plugin (andlabs,gocui,etc)
|
||||
--no-gui ignore all these gui problems
|
||||
--gui GUI Use this gui toolkit [andlabs,gocui,nocui,stdin]
|
||||
--gui-file GUI-FILE Use a specific plugin.so file
|
||||
--gui-build attempt to build the GUI plugins
|
||||
--gui-verbose enable all logging
|
||||
--bash generate bash completion
|
||||
--bash generate bash completion
|
||||
--gui-check-plugin GUI-CHECK-PLUGIN
|
||||
hack to verify GO plugins load
|
||||
--connect CONNECT forge url
|
||||
--all git commit --all
|
||||
--build BUILD build a repo
|
||||
|
@ -18,24 +24,25 @@ Options:
|
|||
--forge-rebuild download and rebuild forge
|
||||
--force try to strong arm things
|
||||
--verbose show more output
|
||||
--bash generate bash completion
|
||||
--auto-complete AUTO-COMPLETE
|
||||
todo: move this to go-arg
|
||||
--help, -h display this help and exit
|
||||
--version display version and exit
|
||||
|
||||
Commands:
|
||||
|
||||
help New to forge? This is for you.'
|
||||
checkout switch branches using 'git checkout'
|
||||
clean start over at the beginning
|
||||
commit 'git commit' but errors out if on wrong branch
|
||||
config show your .config/forge/ settings
|
||||
debug debug forge
|
||||
dirty show dirty git repos
|
||||
fetch run 'git fetch master'
|
||||
gui open the gui
|
||||
list print a table of the current repos
|
||||
merge merge branches
|
||||
normal set every repo to the default state for software development
|
||||
patch make patchsets
|
||||
pull run 'git pull'
|
||||
tag manage git tags
|
||||
*/
|
||||
package main
|
||||
|
|
2
exit.go
2
exit.go
|
@ -28,6 +28,6 @@ func badExit(err error) {
|
|||
}
|
||||
|
||||
func badRepoExit(repo *gitpb.Repo, err error) {
|
||||
log.Printf("%s FAILED: %v\n", repo.GetNamespace(), err)
|
||||
log.Printf("forge failed on %s with %v\n", repo.GetNamespace(), err)
|
||||
os.Exit(-1)
|
||||
}
|
||||
|
|
|
@ -12,33 +12,15 @@ import (
|
|||
"strings"
|
||||
|
||||
"go.wit.com/lib/protobuf/forgepb"
|
||||
"go.wit.com/lib/protobuf/gitpb"
|
||||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
func makeReposTablePB(pb *gitpb.Repos) *gitpb.ReposTable {
|
||||
t := pb.NewTable("quickListRepos")
|
||||
t.NewUuid()
|
||||
|
||||
sf := t.AddStringFunc("Namespace", func(r *gitpb.Repo) string {
|
||||
return r.GetNamespace()
|
||||
})
|
||||
sf.Width = 16
|
||||
|
||||
userVer := t.AddStringFunc("user", func(repo *gitpb.Repo) string {
|
||||
ver := repo.GetUserVersion()
|
||||
return ver
|
||||
})
|
||||
userVer.Width = 4
|
||||
return t
|
||||
}
|
||||
|
||||
/*
|
||||
type stdPatchsetTableWin struct {
|
||||
sync.Mutex
|
||||
win *gadgets.GenericWindow // the machines gui window
|
||||
box *gui.Node // the machines gui parent box widget
|
||||
TB *forgepb.SetsTable // the gui table buffer
|
||||
TB *forgepb.PatchsetsTable // the gui table buffer
|
||||
update bool // if the window should be updated
|
||||
}
|
||||
|
||||
|
@ -54,7 +36,7 @@ func (w *stdPatchsetTableWin) Toggle() {
|
|||
*/
|
||||
|
||||
/*
|
||||
etimef := func(e *forgepb.Set) string {
|
||||
etimef := func(e *forgepb.Patchset) string {
|
||||
etime := e.Etime.AsTime()
|
||||
s := etime.Format("2006/01/02 15:04")
|
||||
if strings.HasPrefix(s, "1970/") {
|
||||
|
@ -67,14 +49,14 @@ func (w *stdPatchsetTableWin) Toggle() {
|
|||
*/
|
||||
|
||||
/*
|
||||
ctimef := func(p *forgepb.Set) string {
|
||||
ctimef := func(p *forgepb.Patchset) string {
|
||||
ctime := p.Ctime.AsTime()
|
||||
return ctime.Format("2006/01/02 15:04")
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
func setPatchsetState(p *forgepb.Set) {
|
||||
func setPatchsetState(p *forgepb.Patchset) {
|
||||
var bad bool
|
||||
var good bool
|
||||
var done bool = true
|
||||
|
@ -173,33 +155,53 @@ func findCommitBySubject(subject string) (string, error) {
|
|||
}
|
||||
|
||||
// returns true if PB changed
|
||||
func setNewCommitHash(patch *forgepb.Patch) error {
|
||||
func setNewCommitHash(patch *forgepb.Patch) bool {
|
||||
// parts := strings.Fields(patch.Comment)
|
||||
|
||||
repo := me.forge.FindByGoPath(patch.Namespace)
|
||||
if repo == nil {
|
||||
return log.Errorf("could not find repo %s", patch.Namespace)
|
||||
log.Info("could not find repo", patch.Namespace)
|
||||
return false
|
||||
}
|
||||
|
||||
comment := cleanSubject(patch.Comment)
|
||||
|
||||
if patch.NewHash == "" {
|
||||
log.Info("init() new patch to 'na' ", patch.NewHash, "commithash:", patch.CommitHash, patch.Namespace, comment)
|
||||
patch.NewHash = "na"
|
||||
return true
|
||||
}
|
||||
os.Chdir(repo.GetFullPath())
|
||||
newhash, err := findCommitBySubject(comment)
|
||||
if err != nil {
|
||||
return log.Errorf("patch: not found hash: %s %s %s %s %v", patch.CommitHash, patch.Namespace, comment, newhash, err)
|
||||
log.Info("patch: not found hash:", patch.CommitHash, patch.Namespace, comment, newhash, err)
|
||||
return false
|
||||
}
|
||||
|
||||
patchId, err := repo.FindPatchId(newhash)
|
||||
if err != nil {
|
||||
return err
|
||||
if patch.NewHash == newhash {
|
||||
// patch was already set
|
||||
return false
|
||||
}
|
||||
if patch.NewHash != "na" {
|
||||
log.Infof("patch: hash MISMATCH %s old=%s new=%s name=%s\n", patch.Namespace, patch.NewHash, newhash, comment)
|
||||
return false
|
||||
}
|
||||
|
||||
patch.PatchId = patchId
|
||||
patch.NewHash = newhash
|
||||
|
||||
log.Info("patch: found hash:", patch.CommitHash, newhash, patch.Namespace, comment)
|
||||
return nil
|
||||
return true
|
||||
}
|
||||
|
||||
func AddAllPatches(notdone *forgepb.Patches, pset *forgepb.Set, full bool) {
|
||||
/*
|
||||
func setNewCommitHashLoop(p *forgepb.Patchset) bool {
|
||||
var done bool = true
|
||||
for patch := range p.Patches.IterAll() {
|
||||
setNewCommitHashLoop(patch)
|
||||
}
|
||||
|
||||
return done
|
||||
}
|
||||
*/
|
||||
|
||||
func AddAllPatches(notdone *forgepb.Patches, pset *forgepb.Patchset, full bool) {
|
||||
for patch := range pset.Patches.IterAll() {
|
||||
comment := cleanSubject(patch.Comment)
|
||||
|
||||
|
@ -213,7 +215,7 @@ func AddAllPatches(notdone *forgepb.Patches, pset *forgepb.Set, full bool) {
|
|||
}
|
||||
}
|
||||
|
||||
func AddNotDonePatches(notdone *forgepb.Patches, pset *forgepb.Set, full bool) {
|
||||
func AddNotDonePatches(notdone *forgepb.Patches, pset *forgepb.Patchset, full bool) {
|
||||
for patch := range pset.Patches.IterAll() {
|
||||
comment := cleanSubject(patch.Comment)
|
||||
|
||||
|
@ -231,7 +233,7 @@ func AddNotDonePatches(notdone *forgepb.Patches, pset *forgepb.Set, full bool) {
|
|||
continue
|
||||
}
|
||||
|
||||
if patch.NewHash != "" {
|
||||
if patch.NewHash != "na" {
|
||||
log.Info("already applied patch", patch.Namespace, ": newhash:", patch.NewHash, "commithash:", patch.CommitHash, comment)
|
||||
continue
|
||||
}
|
||||
|
@ -281,7 +283,7 @@ func findExpired() *forgepb.Patches {
|
|||
continue
|
||||
}
|
||||
|
||||
if patch.NewHash != "" {
|
||||
if patch.NewHash != "na" {
|
||||
log.Info("already applied patch", patch.Namespace, ": newhash:", patch.NewHash, "commithash:", patch.CommitHash, comment)
|
||||
found.AppendByCommitHash(patch) // double check to ensure the commit hash isn't added twice
|
||||
continue
|
||||
|
|
55
main.go
55
main.go
|
@ -7,9 +7,13 @@ package main
|
|||
|
||||
import (
|
||||
"embed"
|
||||
"fmt"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"go.wit.com/dev/alexflint/arg"
|
||||
"go.wit.com/lib/gui/prep"
|
||||
"go.wit.com/lib/gui/shell"
|
||||
"go.wit.com/lib/protobuf/forgepb"
|
||||
"go.wit.com/lib/protobuf/gitpb"
|
||||
"go.wit.com/log"
|
||||
|
@ -39,17 +43,24 @@ func getVersion(repo *gitpb.Repo, name string) string {
|
|||
return strings.TrimSpace(output)
|
||||
}
|
||||
|
||||
func reloadCheck(repo *gitpb.Repo) error {
|
||||
if err := repo.ReloadCheck(); err != nil {
|
||||
log.Info("changed:", repo.FullPath)
|
||||
configSave = true
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func main() {
|
||||
me = new(mainType)
|
||||
prep.Bash(ARGNAME, argv.DoAutoComplete) // this line should be: prep.Bash(argv)
|
||||
me.myGui = prep.Gui() // prepares the GUI package for go-args
|
||||
me.auto = prep.Bash3(&argv) // this line should be: prep.Bash(&argv)
|
||||
me.pp = arg.MustParse(&argv)
|
||||
|
||||
// me.auto = prep.Bash3(argv.DoAutoComplete, &argv) // this line should be: prep.Bash(&argv)
|
||||
// arg.MustParse(&argv) // these three lines are becoming terrible syntax
|
||||
// me.auto = prep.MustParse(&argv) // try to make this work?
|
||||
|
||||
me.forge = forgepb.Init() // init forge.pb
|
||||
me.forge.ScanRepoDir() // looks for new dirs, checks existing repos for changes
|
||||
me.forge = forgepb.Init()
|
||||
// me.forge.RillRepos(reloadCheck)
|
||||
me.forge.ScanGoSrc()
|
||||
|
||||
// initialize patches
|
||||
doPatchInit()
|
||||
|
@ -71,6 +82,7 @@ func main() {
|
|||
}
|
||||
|
||||
if argv.Checkout != nil {
|
||||
me.forge.Config.Mode = forgepb.ForgeMode_MASTER
|
||||
if err := doCheckout(); err != nil {
|
||||
badExit(err)
|
||||
}
|
||||
|
@ -120,7 +132,8 @@ func main() {
|
|||
log.Info("you are already in the normal state")
|
||||
okExit("")
|
||||
}
|
||||
setForgeMode(forgepb.ForgeMode_NORMAL)
|
||||
me.forge.Config.Mode = forgepb.ForgeMode_NORMAL
|
||||
me.forge.Config.ConfigSave()
|
||||
log.Info("normal mode on")
|
||||
okExit("")
|
||||
}
|
||||
|
@ -130,7 +143,8 @@ func main() {
|
|||
log.Info("you were aleady not in the normal state")
|
||||
okExit("")
|
||||
}
|
||||
setForgeMode(forgepb.ForgeMode_DEVEL)
|
||||
me.forge.Config.Mode = forgepb.ForgeMode_MASTER
|
||||
me.forge.Config.ConfigSave()
|
||||
log.Info("normal mode off")
|
||||
okExit("")
|
||||
}
|
||||
|
@ -139,7 +153,8 @@ func main() {
|
|||
log.Infof("all %d repos are on your user branch. It is safe to write code now.\n", me.forge.Repos.Len())
|
||||
if me.forge.Config.Mode != forgepb.ForgeMode_NORMAL {
|
||||
log.Infof("Forge has set the mode to 'Normal'\n")
|
||||
setForgeMode(forgepb.ForgeMode_NORMAL)
|
||||
me.forge.Config.Mode = forgepb.ForgeMode_NORMAL
|
||||
me.forge.ConfigSave()
|
||||
}
|
||||
okExit("")
|
||||
}
|
||||
|
@ -155,12 +170,30 @@ func main() {
|
|||
}
|
||||
|
||||
if argv.Merge != nil {
|
||||
if err := doMerge(); err != nil {
|
||||
if argv.Merge.Devel != nil {
|
||||
start := time.Now()
|
||||
repos, err := doMergeDevel()
|
||||
dur := time.Since(start)
|
||||
if err != nil {
|
||||
badExit(err)
|
||||
}
|
||||
log.Printf("Merged %d devel branches in %s\n", repos.Len(), shell.FormatDuration(dur))
|
||||
okExit("")
|
||||
}
|
||||
|
||||
if argv.Merge.Master != nil {
|
||||
start := time.Now()
|
||||
repos, err := doMergeMaster()
|
||||
dur := time.Since(start)
|
||||
if err != nil {
|
||||
badExit(err)
|
||||
}
|
||||
log.Printf("Merged %d master branches in %s\n", repos.Len(), shell.FormatDuration(dur))
|
||||
okExit("")
|
||||
}
|
||||
badExit(fmt.Errorf("You must choose which branch to merge to (devel or master)"))
|
||||
}
|
||||
|
||||
if argv.Pull != nil {
|
||||
doPull()
|
||||
okExit("")
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"go.wit.com/dev/alexflint/arg"
|
||||
"go.wit.com/gui"
|
||||
"go.wit.com/lib/gadgets"
|
||||
"go.wit.com/lib/gui/prep"
|
||||
|
@ -27,8 +28,7 @@ func myServer() string {
|
|||
|
||||
// this app's variables
|
||||
type mainType struct {
|
||||
// pp *arg.Parser // for parsing the command line args. Yay to alexflint!
|
||||
auto *prep.Auto // more experiments for bash handling
|
||||
pp *arg.Parser // for parsing the command line args. Yay to alexf lint!
|
||||
forge *forgepb.Forge // for holding the forge protobuf files
|
||||
myGui *prep.GuiPrep // for initializing the GUI toolkits
|
||||
foundPaths []string // stores gopaths to act on (when doing go-clone)
|
||||
|
|
|
@ -117,9 +117,12 @@ func applyPatchLabel(p *forgepb.Patch) string {
|
|||
// log.Info("Could not figure out repo path", rn)
|
||||
return ""
|
||||
}
|
||||
if p.NewHash == "" {
|
||||
if p.NewHash == "na" {
|
||||
return "git am"
|
||||
}
|
||||
if p.NewHash == "" {
|
||||
return "new"
|
||||
}
|
||||
return "done"
|
||||
}
|
||||
|
||||
|
|
|
@ -99,7 +99,7 @@ func makeReposWin() *stdReposTableWin {
|
|||
cmd = []string{"git", "branch", "--delete", "--remote", "origin/" + brname}
|
||||
log.Info(repo.GetGoPath(), cmd)
|
||||
repo.RunVerbose(cmd)
|
||||
repo.ReloadCheck()
|
||||
repo.Reload()
|
||||
}
|
||||
me.forge.SetConfigSave(true)
|
||||
me.forge.ConfigSave()
|
||||
|
|
|
@ -22,7 +22,7 @@ type repoPatchWindow struct {
|
|||
grid *gui.Node // the list of available patches
|
||||
// summary *patchSummary // summary of current patches
|
||||
setgrid *gui.Node // the list of each patchset
|
||||
pset *forgepb.Set // the patchset in question
|
||||
pset *forgepb.Patchset // the patchset in question
|
||||
}
|
||||
|
||||
// todo: autogenerate these or make them standared 'gui' package functions
|
||||
|
@ -109,7 +109,7 @@ func makeRepoPatchWindow(repo *gitpb.Repo, fset []*forgepb.Patch) *repoPatchWind
|
|||
return pw
|
||||
}
|
||||
|
||||
func (r *repoPatchWindow) addPatchset(grid *gui.Node, pset *forgepb.Set) {
|
||||
func (r *repoPatchWindow) addPatchset(grid *gui.Node, pset *forgepb.Patchset) {
|
||||
repomap := make(map[*gitpb.Repo][]*forgepb.Patch)
|
||||
repohash := make(map[*gitpb.Repo]string)
|
||||
|
||||
|
|
Loading…
Reference in New Issue