rethink the patch options
This commit is contained in:
parent
4d4aad27e4
commit
3db2e7ff6c
9
argv.go
9
argv.go
|
@ -13,7 +13,7 @@ var argv args
|
||||||
|
|
||||||
type args struct {
|
type args struct {
|
||||||
Checkout *CheckoutCmd `arg:"subcommand:checkout" help:"switch branches using 'git checkout'"`
|
Checkout *CheckoutCmd `arg:"subcommand:checkout" help:"switch branches using 'git checkout'"`
|
||||||
Clean *CleanCmd `arg:"subcommand:clean" help:"clean git branches"`
|
Clean *CleanCmd `arg:"subcommand:clean" help:"start over at the beginning"`
|
||||||
Commit *EmptyCmd `arg:"subcommand:commit" help:"'git commit' but errors out if on wrong branch"`
|
Commit *EmptyCmd `arg:"subcommand:commit" help:"'git commit' but errors out if on wrong branch"`
|
||||||
Config *ConfigCmd `arg:"subcommand:config" help:"show your .config/forge/ settings"`
|
Config *ConfigCmd `arg:"subcommand:config" help:"show your .config/forge/ settings"`
|
||||||
Dirty *DirtyCmd `arg:"subcommand:dirty" help:"show repos git says are dirty"`
|
Dirty *DirtyCmd `arg:"subcommand:dirty" help:"show repos git says are dirty"`
|
||||||
|
@ -64,9 +64,10 @@ type CleanDevelCmd struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
type PatchCmd struct {
|
type PatchCmd struct {
|
||||||
List *EmptyCmd `arg:"subcommand:list" help:"list available patches"`
|
List *EmptyCmd `arg:"subcommand:list" help:"your downloaded patchsets"`
|
||||||
Show *EmptyCmd `arg:"subcommand:show" help:"show a specific patch"`
|
Get *EmptyCmd `arg:"subcommand:get" help:"get the new patchsets"`
|
||||||
Submit string `arg:"--submit" help:"submit a new patchset with name"`
|
Show *EmptyCmd `arg:"subcommand:show" help:"your pending commits to your code"`
|
||||||
|
Submit string `arg:"--submit" help:"submit your commits"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ConfigAddCmd struct {
|
type ConfigAddCmd struct {
|
||||||
|
|
|
@ -43,7 +43,7 @@ func (args) doBashAuto() {
|
||||||
case "pull":
|
case "pull":
|
||||||
fmt.Println("--verbose")
|
fmt.Println("--verbose")
|
||||||
case "patch":
|
case "patch":
|
||||||
fmt.Println("list --submit show")
|
fmt.Println("get list --submit show")
|
||||||
case "user":
|
case "user":
|
||||||
fmt.Println("--force")
|
fmt.Println("--force")
|
||||||
case "devel":
|
case "devel":
|
||||||
|
|
15
doPatch.go
15
doPatch.go
|
@ -19,13 +19,15 @@ func doPatch() error {
|
||||||
if argv.Patch.List != nil {
|
if argv.Patch.List != nil {
|
||||||
return doPatchList()
|
return doPatchList()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if no option is given to patch, list out the
|
||||||
|
// repos that have patches ready in them
|
||||||
findReposWithPatches()
|
findReposWithPatches()
|
||||||
if me.found.Len() == 0 {
|
if me.found.Len() == 0 {
|
||||||
log.Info("you have no patches in your user branches")
|
log.Info("you currently have no patches in your user branches")
|
||||||
okExit("patch list empty")
|
return nil
|
||||||
}
|
}
|
||||||
me.forge.PrintHumanTable(me.found)
|
me.forge.PrintHumanTable(me.found)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,6 +65,7 @@ func dumpPatchset(pset *forgepb.Patchset) bool {
|
||||||
if IsValidPatch(p) {
|
if IsValidPatch(p) {
|
||||||
// ok
|
// ok
|
||||||
} else {
|
} else {
|
||||||
|
pset.State = "BROKEN"
|
||||||
bad += 1
|
bad += 1
|
||||||
}
|
}
|
||||||
count += 1
|
count += 1
|
||||||
|
@ -77,6 +80,9 @@ func dumpPatchset(pset *forgepb.Patchset) bool {
|
||||||
func IsValidPatch(p *forgepb.Patch) bool {
|
func IsValidPatch(p *forgepb.Patch) bool {
|
||||||
basepath, filename := filepath.Split(p.Filename)
|
basepath, filename := filepath.Split(p.Filename)
|
||||||
repo := me.forge.FindByGoPath(basepath)
|
repo := me.forge.FindByGoPath(basepath)
|
||||||
|
if argv.Verbose {
|
||||||
|
log.Info("start:", p.StartHash, "end:", p.CommitHash, "file:", basepath, filename, "devel version", repo.GetDevelVersion())
|
||||||
|
}
|
||||||
if repo == nil {
|
if repo == nil {
|
||||||
log.Info("can not apply patch! repo not found", basepath, filename)
|
log.Info("can not apply patch! repo not found", basepath, filename)
|
||||||
return false
|
return false
|
||||||
|
@ -85,6 +91,9 @@ func IsValidPatch(p *forgepb.Patch) bool {
|
||||||
log.Info("can not apply patch! devel hash mismatch", basepath, filename)
|
log.Info("can not apply patch! devel hash mismatch", basepath, filename)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
if repo.DevelHash() == p.StartHash {
|
||||||
|
log.Info("local devel hash:", repo.DevelHash(), "matches patch hash", p.StartHash, "and can be applied")
|
||||||
|
}
|
||||||
log.Info("start:", p.StartHash, "end:", p.CommitHash, "file:", basepath, filename, "devel version", repo.GetDevelVersion())
|
log.Info("start:", p.StartHash, "end:", p.CommitHash, "file:", basepath, filename, "devel version", repo.GetDevelVersion())
|
||||||
for _, line := range p.Files {
|
for _, line := range p.Files {
|
||||||
log.Info("\t", line)
|
log.Info("\t", line)
|
||||||
|
|
Loading…
Reference in New Issue