def not_check(repo, cmd): '''return a function which returns boolean indicating whether a file should be skipped for CMD.''' # # The ignore routines need a canonical path to the file (relative to the # repo root), whereas the check commands get paths relative to the cwd. # # Wrap our argument such that the path is canonified before it is checked. # def canonified_check(ignfunc): def f(path): cpath = util.canonpath(repo.root, repo.getcwd(), path) return ignfunc(cpath) return f ignorefiles = [] for f in [repo.join('cdm/%s.NOT' % cmd), repo.wjoin('exception_lists/%s' % cmd)]: if os.path.exists(f): ignorefiles.append(f) if ignorefiles: ign = Ignore.ignore(repo.root, ignorefiles) return canonified_check(ign) else: return util.never
def not_check(root, cmd): """Return a function which returns True if a file given as an argument should be excluded from the check named by 'cmd'""" ignorefiles = filter(os.path.exists, [os.path.join(root, ".git", "%s.NOT" % cmd), os.path.join(root, "exception_lists", cmd)]) return Ignore.ignore(root, ignorefiles)