redo: only default to 'all' in the toplevel instance of redo.

We already did this in minimal/do, and redo-ifchange already did this, but
plain redo didn't.  This made constructs like:

	for d in *.x; do
		echo "${d%.x}"
	done | xargs redo

dangerous, because if there were no matching files, we'd try to 'redo all'.
This commit is contained in:
Avery Pennarun 2011-03-10 21:10:15 -08:00
commit 07af5d83f9
3 changed files with 5 additions and 2 deletions

View file

@ -19,7 +19,7 @@ version print the current version and exit
o = options.Options('redo', optspec) o = options.Options('redo', optspec)
(opt, flags, extra) = o.parse(sys.argv[1:]) (opt, flags, extra) = o.parse(sys.argv[1:])
targets = extra or ['all'] targets = extra
if opt.version: if opt.version:
import version import version

View file

@ -1,2 +1,3 @@
redo-ifchange redo-ifchange
redo-ifcreate
redo

View file

@ -3,6 +3,8 @@ import sys, os
def init(targets): def init(targets):
if not os.environ.get('REDO'): if not os.environ.get('REDO'):
# toplevel call to redo # toplevel call to redo
if len(targets) == 0:
targets.append('all')
exenames = [os.path.abspath(sys.argv[0]), exenames = [os.path.abspath(sys.argv[0]),
os.path.realpath(sys.argv[0])] os.path.realpath(sys.argv[0])]
dirnames = [os.path.dirname(p) for p in exenames] dirnames = [os.path.dirname(p) for p in exenames]