view website/issues/detectors/patches.py @ 5277:b580f61929e2

Removing richard from notification list. Verified that he doesn't want to be on it anymore. Date: Sun, 24 Sep 2017 14:58:24 +1000 To: rouiljsomewhere From: Richard Jones <r1chardj0n3s at gmail.com> Subject: Re: Do you still want new issues to roundup tracker sent to you? --94eb2c0da3aac771bb0559e84afb Content-Type: text/plain; charset="UTF-8" Thanks John, yes please do remove me. Richard On 24 September 2017 at 14:13, John P. Rouillard <rouilj at cs.umb.edu> wrote: > Hi Richard: > > I am working on updating the roundup tracker to > get it ready for the current development code. > > As I was testing I noticed you are still in the > list of email addresses getting new issue emails. > > Do you want to continue to receive these since > you aren't actively developing roundup?
author John Rouillard <rouilj@ieee.org>
date Sun, 24 Sep 2017 18:44:48 -0400
parents c2d0d3e9099d
children 0942fe89e82e
line wrap: on
line source

# Auditor for patch files
# Patches should be declared as text/plain (also .py files),
# independent of what the browser says, and
# the "patch" keyword should get set automatically.

import posixpath

patchtypes = ('.diff', '.patch')
sourcetypes = ('.diff', '.patch', '.py')

def ispatch(file, types):
    return posixpath.splitext(file)[1] in types

def patches_text_plain(db, cl, nodeid, newvalues):
    if ispatch(newvalues['name'], sourcetypes):
        newvalues['type'] = 'text/plain'

def patches_keyword(db, cl, nodeid, newvalues):
    # Check whether there are any new files
    newfiles = set(newvalues.get('files',()))
    if nodeid:
        newfiles -= set(db.issue.get(nodeid, 'files'))
    # Check whether any of these is a patch
    newpatch = False
    for fileid in newfiles:
        if ispatch(db.file.get(fileid, 'name'), patchtypes):
            newpatch = True
            break
    if newpatch:
        # Add the patch keyword if its not already there
        patchid = db.keyword.lookup("patch")
        oldkeywords = []
        if nodeid:
            oldkeywords = db.issue.get(nodeid, 'keywords')
            if patchid in oldkeywords:
                # This is already marked as a patch
                return
        if not newvalues.has_key('keywords'):
            newvalues['keywords'] = oldkeywords
        newvalues['keywords'].append(patchid)

def init(db):
    db.file.audit('create', patches_text_plain)
    db.issue.audit('create', patches_keyword)
    db.issue.audit('set', patches_keyword)

Roundup Issue Tracker: http://roundup-tracker.org/