fixes from cleaning an old set of repos
This commit is contained in:
parent
dd7355571d
commit
7402aaded7
1
argv.go
1
argv.go
|
@ -19,6 +19,7 @@ type args struct {
|
||||||
List *FindCmd `arg:"subcommand:list" help:"just show a table of the current state"`
|
List *FindCmd `arg:"subcommand:list" help:"just show a table of the current state"`
|
||||||
Patch *PatchCmd `arg:"subcommand:patch" help:"examine and make patch sets"`
|
Patch *PatchCmd `arg:"subcommand:patch" help:"examine and make patch sets"`
|
||||||
GitPull *FindCmd `arg:"subcommand:pull" help:"run 'git pull'"`
|
GitPull *FindCmd `arg:"subcommand:pull" help:"run 'git pull'"`
|
||||||
|
GitFetch *FindCmd `arg:"subcommand:fetch" help:"run 'git fetch master'"`
|
||||||
Rescan *EmptyCmd `arg:"subcommand:rescan" help:"recreate the git protobuf repos.pb file"`
|
Rescan *EmptyCmd `arg:"subcommand:rescan" help:"recreate the git protobuf repos.pb file"`
|
||||||
Delete *EmptyCmd `arg:"subcommand:delete" help:"untrack a repo"`
|
Delete *EmptyCmd `arg:"subcommand:delete" help:"untrack a repo"`
|
||||||
Commit *EmptyCmd `arg:"subcommand:commit" help:"smart 'git commit' (errors out if on wrong branch)"`
|
Commit *EmptyCmd `arg:"subcommand:commit" help:"smart 'git commit' (errors out if on wrong branch)"`
|
||||||
|
|
|
@ -38,7 +38,7 @@ func (args) doBashAuto() {
|
||||||
case "list":
|
case "list":
|
||||||
fmt.Println("--all --mine --favorites --private patches")
|
fmt.Println("--all --mine --favorites --private patches")
|
||||||
case "pull":
|
case "pull":
|
||||||
fmt.Println("--all --mine --favorites --private")
|
fmt.Println("--verbose")
|
||||||
case "patch":
|
case "patch":
|
||||||
fmt.Println("list --submit show")
|
fmt.Println("list --submit show")
|
||||||
case "user":
|
case "user":
|
||||||
|
|
|
@ -199,6 +199,7 @@ func rillCheckoutMaster(repo *gitpb.Repo) error {
|
||||||
repo.CheckoutMaster()
|
repo.CheckoutMaster()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
if repo.GetUserVersion() != repo.GetDevelVersion() {
|
if repo.GetUserVersion() != repo.GetDevelVersion() {
|
||||||
// don't switch branches if the user branch has uncommitted patches
|
// don't switch branches if the user branch has uncommitted patches
|
||||||
return nil
|
return nil
|
||||||
|
@ -207,6 +208,7 @@ func rillCheckoutMaster(repo *gitpb.Repo) error {
|
||||||
// don't switch braches if the devel branch does not match master (needs merge)
|
// don't switch braches if the devel branch does not match master (needs merge)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
repo.CheckoutMaster()
|
repo.CheckoutMaster()
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
41
doPull.go
41
doPull.go
|
@ -1,10 +1,50 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"go.wit.com/lib/gui/shell"
|
||||||
"go.wit.com/lib/protobuf/gitpb"
|
"go.wit.com/lib/protobuf/gitpb"
|
||||||
"go.wit.com/log"
|
"go.wit.com/log"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func rillPull(repo *gitpb.Repo) error {
|
||||||
|
if repo.IsDirty() {
|
||||||
|
// never do dirty repos
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
t, _ := repo.LastGitPull()
|
||||||
|
if time.Since(t) < time.Hour {
|
||||||
|
if argv.Verbose {
|
||||||
|
log.Info(repo.GetFullPath(), "git pulled too recently", shell.FormatDuration(time.Since(t)))
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
var cmd []string
|
||||||
|
cmd = append(cmd, "git", "pull")
|
||||||
|
_, err := repo.RunVerbose(cmd)
|
||||||
|
if err != nil {
|
||||||
|
log.Info(repo.GetFullPath(), "git pull err:", err)
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
// is every repo on the devel branch?
|
||||||
|
|
||||||
|
func doGitPullNew() {
|
||||||
|
now := time.Now()
|
||||||
|
me.forge.RillFuncError(rillPull)
|
||||||
|
count := me.forge.RillReload()
|
||||||
|
if count != 0 {
|
||||||
|
me.forge.ConfigSave()
|
||||||
|
}
|
||||||
|
|
||||||
|
total, count, nope, _ := IsEverythingOnMaster()
|
||||||
|
log.Printf("Master branch check. %d total repos. (%d git pulled) (%d not on master branch) (%s)\n", total, count, nope, shell.FormatDuration(time.Since(now)))
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
func doGitPull() {
|
func doGitPull() {
|
||||||
allerr := me.found.RillGitPull(40, 5)
|
allerr := me.found.RillGitPull(40, 5)
|
||||||
|
|
||||||
|
@ -29,6 +69,7 @@ func doGitPull() {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
// git fetch origin master:master
|
// git fetch origin master:master
|
||||||
func rillFetchMaster(repo *gitpb.Repo) error {
|
func rillFetchMaster(repo *gitpb.Repo) error {
|
||||||
|
|
8
main.go
8
main.go
|
@ -119,12 +119,18 @@ func main() {
|
||||||
okExit("")
|
okExit("")
|
||||||
}
|
}
|
||||||
|
|
||||||
if argv.GitPull != nil {
|
if argv.GitFetch != nil {
|
||||||
// argv.GitPull.findRepos()
|
// argv.GitPull.findRepos()
|
||||||
doGitFetch()
|
doGitFetch()
|
||||||
okExit("")
|
okExit("")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if argv.GitPull != nil {
|
||||||
|
// argv.GitPull.findRepos()
|
||||||
|
doGitPullNew()
|
||||||
|
okExit("")
|
||||||
|
}
|
||||||
|
|
||||||
if argv.GitReset != nil {
|
if argv.GitReset != nil {
|
||||||
findAll() // select all the repos
|
findAll() // select all the repos
|
||||||
doGitReset()
|
doGitReset()
|
||||||
|
|
Loading…
Reference in New Issue