misc code cleanups
This commit is contained in:
parent
8fabd77b49
commit
335531e0fb
1
argv.go
1
argv.go
|
@ -57,6 +57,7 @@ type ConfigAddCmd struct {
|
||||||
Favorite bool `arg:"--favorite" default:"false" help:"forge will always go-clone or git clone this"`
|
Favorite bool `arg:"--favorite" default:"false" help:"forge will always go-clone or git clone this"`
|
||||||
Private bool `arg:"--private" default:"false" help:"repo can not be published"`
|
Private bool `arg:"--private" default:"false" help:"repo can not be published"`
|
||||||
Interesting bool `arg:"--interesting" default:"false" help:"something you decided was cool"`
|
Interesting bool `arg:"--interesting" default:"false" help:"something you decided was cool"`
|
||||||
|
DebName string `arg:"--debname" help:"the name of the debian package (or rpm, etc)"`
|
||||||
Master string `arg:"--master" help:"the git 'master' or 'main' branch name"`
|
Master string `arg:"--master" help:"the git 'master' or 'main' branch name"`
|
||||||
Devel string `arg:"--devel" help:"the git devel branch name"`
|
Devel string `arg:"--devel" help:"the git devel branch name"`
|
||||||
User string `arg:"--user" help:"the git user branch name"`
|
User string `arg:"--user" help:"the git user branch name"`
|
||||||
|
|
40
doDirty.go
40
doDirty.go
|
@ -16,29 +16,35 @@ func doDirty() {
|
||||||
me.forge.PrintHumanTableDirty(me.found)
|
me.forge.PrintHumanTableDirty(me.found)
|
||||||
}
|
}
|
||||||
|
|
||||||
func doCheckDirtyAndConfigSave() {
|
func straightCheckDirty() int {
|
||||||
var count int
|
var count int
|
||||||
|
var total int
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
// log.Info("before findAll()")
|
all := me.found.All()
|
||||||
all := me.found.SortByFullPath()
|
|
||||||
for all.Scan() {
|
for all.Scan() {
|
||||||
repo := all.Next()
|
repo := all.Next()
|
||||||
// log.Info("before isDirty()")
|
total += 1
|
||||||
dirty := repo.IsDirty()
|
if repo.IsDirty() {
|
||||||
if repo.CheckDirty() {
|
|
||||||
count += 1
|
count += 1
|
||||||
if me.found.AppendByGoPath(repo) {
|
|
||||||
log.Info("doCheckDirtyAndConfigSave() repo already existed", repo.GetGoPath())
|
|
||||||
}
|
|
||||||
if !dirty {
|
|
||||||
configSave = true
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if dirty {
|
|
||||||
configSave = true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
log.Printf("rill dirty check (%d dirty repos) (%d total repos) took:%s\n", count, total, shell.FormatDuration(time.Since(now)))
|
||||||
|
return count
|
||||||
|
}
|
||||||
|
|
||||||
|
func doCheckDirtyAndConfigSave() {
|
||||||
|
start := straightCheckDirty()
|
||||||
|
now := time.Now()
|
||||||
|
// log.Info("before findAll()")
|
||||||
|
all := me.found.All()
|
||||||
|
for all.Scan() {
|
||||||
|
repo := all.Next()
|
||||||
|
repo.CheckDirty()
|
||||||
|
}
|
||||||
|
end := straightCheckDirty()
|
||||||
|
log.Printf("dirty check (%d dirty repos) (%d total repos) took:%s\n", end, me.found.Len(), shell.FormatDuration(time.Since(now)))
|
||||||
|
if start != end {
|
||||||
|
// todo: use internal forgepb configsave flag. should work?
|
||||||
|
me.forge.ConfigSave()
|
||||||
}
|
}
|
||||||
log.Printf("dirty check (%d repos) took:%s\n", count, shell.FormatDuration(time.Since(now)))
|
|
||||||
me.forge.SetConfigSave(configSave)
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue