Ejemplo n.º 1
0
def keywords(root, parent, flist, output):
    ret = 0
    output.write("SCCS Keywords:\n")
    for f in flist():
        with io.open(f, encoding='utf-8', errors='replace') as fh:
            ret |= Keywords.keywords(fh, output=output)
    return ret
Ejemplo n.º 2
0
def cdm_keywords(ui, repo, *args, **opts):
    '''check active files for SCCS keywords

    Check that any added or modified files do not contain SCCS keywords
    (#ident lines, etc.).

    Files can be excluded from this check using the keywords.NOT file.
    See NOT Files in the extension documentation ('hg help cdm').
    '''

    filelist = buildfilelist(wslist[repo], opts.get('parent'), args)
    exclude = not_check(repo, 'keywords')
    ret = 0

    ui.write('Keywords check:\n')

    for f, e in filelist:
        if e and e.is_removed():
            continue
        elif (e or opts.get('honour_nots')) and exclude(f):
            ui.status('Skipping %s...\n' % f)
            continue

        fh = open(f, 'r')
        ret |= Keywords.keywords(fh, output=ui)
        fh.close()
    return ret
Ejemplo n.º 3
0
def keywords(root, parent, flist, output):
    ret = 0
    output.write("SCCS Keywords:\n")
    for f in flist():
        fh = open(f, 'r')
        ret |= Keywords.keywords(fh, output=output)
        fh.close()
    return ret
Ejemplo n.º 4
0
def keywords(root, parent, flist, output):
    ret = 0
    output.write("SCCS Keywords:\n")
    for f in flist():
        fh = open(f, 'r')
        ret |= Keywords.keywords(fh, output=output)
        fh.close()
    return ret
Ejemplo n.º 5
0
def cdm_keywords(ui, repo, *args, **opts):
    '''check source files do not contain SCCS keywords'''

    filelist = buildfilelist(wslist[repo], opts.get('parent'), args)
    exclude = not_check(repo, 'keywords')
    ret = 0

    ui.write('Keywords check:\n')

    for f, e in filelist:
        if e and e.is_removed():
            continue
        elif (e or opts.get('honour_nots')) and exclude(f):
            ui.status('Skipping %s...\n' % f)
            continue

        fh = open(f, 'r')
        ret |= Keywords.keywords(fh, output=ui)
        fh.close()
    return ret
Ejemplo n.º 6
0
 def check(self, fh, fname=None, lenient=False):
     out = StringIO()
     Keywords.keywords(fh, filename=fname, lenient=lenient,
                       output=out)
     return out.getvalue()