else:
return False
+ignorable = None
+
+def ignore(filename):
+ "Should the specified file be ignored?"
+ global ignorable
+ if ignorable is None:
+ ignorable = []
+ if os.path.exists(".srcignore"):
+ for line in open(".srcignore"):
+ if not line.startswith("#") and line.strip():
+ ignorable += glob.glob(line.strip())
+ return filename in ignorable
+
class CommandContext:
"Consume a revision specification or range from an argument list"
def __init__(self, cmd, args,
else:
candidates = [f for f in os.listdir(".") if f != repodir]
pairs = []
- ignorable = []
- if os.path.exists(".srcignore"):
- for line in open(".srcignore"):
- if not line.startswith("#") and line.strip():
- ignorable += glob.glob(line.strip())
for fn in candidates:
- if fn in ignorable:
+ if ignore(fn):
if fn in args:
pairs.append((fn, "I"))
continue
masterbase = os.path.basename(backend.history(fn))
if masterbase not in registered:
- pairs.append((fn, "?"))
+ if fn in args:
+ pairs.append((fn, "?"))
elif not os.path.exists(fn):
pairs.append((fn, "!"))
# Relies on the fact that we touch the file with utimes(2)