From 944b58e610b60eb8b0115adafc7f983c4de3a175 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Thu, 13 Nov 2014 17:42:03 -0500 Subject: [PATCH] Small change in behavior - no ? status reported except for explicit args. Factor out ignore(). Soon CommandContext() will use it. Regression tests pass. --- src | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src b/src index d319294..ff8638c 100755 --- a/src +++ b/src @@ -417,6 +417,19 @@ def parse_as_revspec(token): 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, @@ -744,19 +757,15 @@ def status_method(*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) -- 2.43.0