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 {
|
||||
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"`
|
||||
Config *ConfigCmd `arg:"subcommand:config" help:"show your .config/forge/ settings"`
|
||||
Dirty *DirtyCmd `arg:"subcommand:dirty" help:"show repos git says are dirty"`
|
||||
|
@ -64,9 +64,10 @@ type CleanDevelCmd struct {
|
|||
}
|
||||
|
||||
type PatchCmd struct {
|
||||
List *EmptyCmd `arg:"subcommand:list" help:"list available patches"`
|
||||
Show *EmptyCmd `arg:"subcommand:show" help:"show a specific patch"`
|
||||
Submit string `arg:"--submit" help:"submit a new patchset with name"`
|
||||
List *EmptyCmd `arg:"subcommand:list" help:"your downloaded patchsets"`
|
||||
Get *EmptyCmd `arg:"subcommand:get" help:"get the new patchsets"`
|
||||
Show *EmptyCmd `arg:"subcommand:show" help:"your pending commits to your code"`
|
||||
Submit string `arg:"--submit" help:"submit your commits"`
|
||||
}
|
||||
|
||||
type ConfigAddCmd struct {
|
||||
|
|
|
@ -43,7 +43,7 @@ func (args) doBashAuto() {
|
|||
case "pull":
|
||||
fmt.Println("--verbose")
|
||||
case "patch":
|
||||
fmt.Println("list --submit show")
|
||||
fmt.Println("get list --submit show")
|
||||
case "user":
|
||||
fmt.Println("--force")
|
||||
case "devel":
|
||||
|
|
15
doPatch.go
15
doPatch.go
|
@ -19,13 +19,15 @@ func doPatch() error {
|
|||
if argv.Patch.List != nil {
|
||||
return doPatchList()
|
||||
}
|
||||
|
||||
// if no option is given to patch, list out the
|
||||
// repos that have patches ready in them
|
||||
findReposWithPatches()
|
||||
if me.found.Len() == 0 {
|
||||
log.Info("you have no patches in your user branches")
|
||||
okExit("patch list empty")
|
||||
log.Info("you currently have no patches in your user branches")
|
||||
return nil
|
||||
}
|
||||
me.forge.PrintHumanTable(me.found)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
@ -63,6 +65,7 @@ func dumpPatchset(pset *forgepb.Patchset) bool {
|
|||
if IsValidPatch(p) {
|
||||
// ok
|
||||
} else {
|
||||
pset.State = "BROKEN"
|
||||
bad += 1
|
||||
}
|
||||
count += 1
|
||||
|
@ -77,6 +80,9 @@ func dumpPatchset(pset *forgepb.Patchset) bool {
|
|||
func IsValidPatch(p *forgepb.Patch) bool {
|
||||
basepath, filename := filepath.Split(p.Filename)
|
||||
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 {
|
||||
log.Info("can not apply patch! repo not found", basepath, filename)
|
||||
return false
|
||||
|
@ -85,6 +91,9 @@ func IsValidPatch(p *forgepb.Patch) bool {
|
|||
log.Info("can not apply patch! devel hash mismatch", basepath, filename)
|
||||
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())
|
||||
for _, line := range p.Files {
|
||||
log.Info("\t", line)
|
||||
|
|
Loading…
Reference in New Issue