Example #1
0
def copyright(root, parent, flist, output):
    ret = 0
    output.write("Copyrights:\n")
    for f in flist():
        with io.open(f, encoding='utf-8', errors='replace') as fh:
            ret |= Copyright.copyright(fh, output=output)
    return ret
Example #2
0
def cdm_copyright(ui, repo, *args, **opts):
    '''check each active file for a current and correct copyright notice

    Check that all active files have a correctly formed copyright
    notice containing the current year.

    See the Non-Formatting Considerations section of the OpenSolaris
    Developer's Reference for more info on the correct form of
    copyright notice.
    (http://hub.opensolaris.org/bin/view/Community+Group+on/devref_7#H723NonFormattingConsiderations)

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

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

    ui.write('Copyright 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 |= Copyright.copyright(fh, output=ui)
        fh.close()
    return ret
Example #3
0
def cdm_copyright(ui, repo, *args, **opts):
    '''check active files for valid copyrights

    Check that all active files have a valid copyright containing the
    current year (and *only* the current year).
    See http://www.opensolaris.org/os/project/muskoka/on_dev/golden_rules.txt
    for more info.'''

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

    ui.write('Copyright 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 |= Copyright.copyright(fh, output=ui)
        fh.close()
    return ret
Example #4
0
def copyright(root, parent, flist, output):
    ret = 0
    output.write("Copyrights:\n")
    for f in flist():
        fh = open(f, 'r')
        ret |= Copyright.copyright(fh, output=output)
        fh.close()
    return ret
Example #5
0
def copyright(root, parent, flist, output):
    ret = 0
    output.write("Copyrights:\n")
    for f in flist():
        fh = open(f, 'r')
        ret |= Copyright.copyright(fh, output=output)
        fh.close()
    return ret
	def copycheck(self, string):
                inp = StringIO(string)
		out = StringIO()
		Copyright.copyright(inp, filename='<test>', output=out)
		return out.getvalue()