Exemplo n.º 1
0
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
Exemplo n.º 2
0
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)
Exemplo n.º 3
0
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)