/goredo
/redo
+/redo-affects
/redo-always
/redo-cleanup
/redo-dot
@command{redo-sources} shows all recursive source files given
targets depend on.
+@item redo-affects
+ List all targets that will be affected by changing the specified ones.
+
@item redo-stamp
Record stamp dependency. Nothing more, dummy. Read about
@ref{Stamping, stamping} in the FAQ.
@node News
@unnumbered News
+@anchor{Release 1.6.0}
+@section Release 1.6.0
+@itemize
+@item
+ @command{redo-affects} command appeared, that shows all targets that
+ will be affected by changing the specified ones.
+@end itemize
+
@anchor{Release 1.5.0}
@section Release 1.5.0
@itemize
cwd, tgtOrig string,
level int,
deps map[string]map[string]struct{},
+ includeSrc bool,
) []string {
cwd, tgt := cwdAndTgt(path.Join(cwd, tgtOrig))
depPath := path.Join(cwd, RedoDir, tgt+DepSuffix)
if dep == "" {
return alwayses
}
- if dep == tgt || isSrc(cwd, dep) {
+ if dep == tgt {
+ continue
+ }
+ if !includeSrc && isSrc(cwd, dep) {
continue
}
if !returnReady {
if m, ok := deps[depRel]; ok {
m[tgtRel] = struct{}{}
} else {
- m = make(map[string]struct{}, 0)
+ m = map[string]struct{}{}
m[tgtRel] = struct{}{}
deps[depRel] = m
}
- alwayses = append(alwayses, collectDeps(cwd, dep, level+1, deps)...)
+ alwayses = append(
+ alwayses,
+ collectDeps(cwd, dep, level+1, deps, includeSrc)...,
+ )
}
}
return alwayses
seen := map[string]struct{}{}
deps := map[string]map[string]struct{}{}
for _, tgtInitial := range tgts {
- for _, tgt := range collectDeps(Cwd, tgtInitial, 0, deps) {
+ for _, tgt := range collectDeps(Cwd, tgtInitial, 0, deps, false) {
if tgt != tgtInitial {
seen[tgt] = struct{}{}
}
rc := 0
for _, cmdName := range []string{
"redo",
+ "redo-affects",
"redo-always",
"redo-cleanup",
"redo-dot",
panic(err)
}
unix.Flock(int(fdLock.Fd()), unix.LOCK_UN)
- OODTgts = make(map[string]struct{})
+ OODTgts = map[string]struct{}{}
for _, tgtRaw := range bytes.Split(tgtsRaw, []byte{0}) {
t := string(tgtRaw)
if t == "" {
for _, tgt := range tgts {
fmt.Println(tgt)
}
+ case "redo-affects":
+ if tgtsWasEmpty {
+ log.Fatalln("no targets specified")
+ }
+ var tgtsKnown []string
+ tgtsKnown, err = targetsWalker([]string{Cwd})
+ if err != nil {
+ break
+ }
+ deps := map[string]map[string]struct{}{}
+ for _, tgt := range tgtsKnown {
+ collectDeps(Cwd, tgt, 0, deps, true)
+ }
+ seen := map[string]struct{}{}
+ for _, tgt := range tgts {
+ collectWholeDeps(deps[tgt], deps, seen)
+ }
+ tgts := make([]string, 0, len(seen))
+ for dep := range seen {
+ tgts = append(tgts, dep)
+ }
+ sort.Strings(tgts)
+ for _, dep := range tgts {
+ fmt.Println(dep)
+ }
case "redo-ood":
if tgtsWasEmpty {
tgts, err = targetsWalker([]string{Cwd})
}
func targetsWalker(tgts []string) ([]string, error) {
- tgtsMap := make(map[string]struct{}, 0)
+ tgtsMap := map[string]struct{}{}
for _, tgt := range tgts {
if err := targetsCollect(tgt, tgtsMap); err != nil {
return nil, err
}
return tgts, nil
}
+
+func collectWholeDeps(
+ tgts map[string]struct{},
+ deps map[string]map[string]struct{},
+ seen map[string]struct{},
+) {
+ for tgt := range tgts {
+ seen[tgt] = struct{}{}
+ collectWholeDeps(deps[tgt], deps, seen)
+ }
+}
)
const (
- Version = "1.5.0"
+ Version = "1.6.0"
Warranty = `Copyright (C) 2020-2021 Sergey Matveev
This program is free software: you can redistribute it and/or modify
d = `Usage: redo-ood [target ...]
List all currently known out-of-date targets.`
+ case "redo-affects":
+ d = `Usage: redo-affects target [...]
+
+List all targets that will be affected by changing the specified ones.`
default:
d = `Usage: goredo -symlinks
goredo expects to be called through the symbolic link to it.
-Available commands: redo, redo-always, redo-cleanup, redo-dot,
-redo-ifchange, redo-ifcreate, redo-log, redo-ood, redo-sources,
-redo-stamp, redo-targets, redo-whichdo.`
+Available commands: redo, redo-affects, redo-always, redo-cleanup,
+redo-dot, redo-ifchange, redo-ifcreate, redo-log, redo-ood,
+redo-sources, redo-stamp, redo-targets, redo-whichdo.`
}
fmt.Fprintf(os.Stderr, "%s\n\nCommon options:\n", d)
flag.PrintDefaults()