Commits

Anonymous committed 5dd18e6 Draft

Remove unused detectors.

Comments (0)

Files changed (2)

detectors/audit2to3.py

-import roundup
-import roundup.instance
-import sets
-
-def update2to3(db, cl, nodeid, newvalues):
-    '''Component 2to3 issues to be assigned to collinwinter unless otherwise
-       assigned.
-    '''
-    # nodeid will be None if this is a new node
-    componentIDS=None
-    if nodeid is not None:
-        componentIDS = cl.get(nodeid, 'components')
-    if newvalues.has_key('components'):
-        componentIDS = newvalues['components']
-    if componentIDS and (theComponent in componentIDS):
-        if not newvalues.has_key('assignee') or \
-               newvalues['assignee'] == Nobody:
-            newvalues['assignee'] = theMan
-
-def init(db):
-    global theMan, theComponent, Nobody
-    theMan = db.user.lookup('collinwinter')
-    Nobody = db.user.lookup('nobody')
-    theComponent = db.component.lookup('2to3 (2.x to 3.0 conversion tool)')
-
-    db.issue.audit('create', update2to3)
-    db.issue.audit('set', update2to3)
-
-if __name__ == '__main__':
-    global theMan, theComponent, Nobody
-    instanceHome='/home/roundup/trackers/tracker'
-    instance = roundup.instance.open(instanceHome)
-    db = instance.open('admin')
-    cl = db.issue
-    nodeID = '1002'
-    theMan = db.user.lookup('collinwinter')
-    Nobody = db.user.lookup('nobody')
-    theComponent = db.component.lookup('2to3 (2.x to 3.0 conversion tool)')
-    newvalues = { 'components': [theComponent] , 'assignee': Nobody}
-    update2to3(db, cl, nodeID, newvalues)
-    print Nobody, theMan, theComponent, newvalues

detectors/cia.py

-# Reactor for sending changes to CIA.vc
-import xmlrpclib
-import cgi
-
-server = "http://CIA.vc"
-
-parameters = {
-    'name':'Roundup Reactor for CIA',
-    'revision': "$Revision$"[11:-2],
-    'project': 'Python',
-    'branch': 'roundup',
-    'urlprefix': 'http://bugs.python.org/issue',
-}
-
-max_content = 150
-
-TEMPLATE = """
-<message>
-<generator>
-  <name>Roundup Reactor for CIA</name>
-  <version>%(revision)s</version>
-</generator>
-<source>
-  <project>%(project)s</project>
-  <module>#%(nodeid)s</module>
-  <branch>%(branch)s</branch>
-</source>
-<body>
-  <commit>
-    <author>%(author)s</author>
-    <files><file>%(file)s</file></files>
-    <log>%(log)s</log>
-    <url>%(urlprefix)s%(nodeid)s</url>
-  </commit>
-</body>
-</message>
-"""
-
-
-def sendcia(db, cl, nodeid, oldvalues):
-    messages = set(cl.get(nodeid, 'messages'))
-    if oldvalues:
-        messages -= set(oldvalues.get('messages',()))
-    if not messages:
-        return
-    messages = list(messages)
-
-    if oldvalues:
-        oldstatus = oldvalues['status']
-    else:
-        oldstatus = None
-    newstatus = db.issue.get(nodeid, 'status')
-    if oldstatus != newstatus:
-        if oldvalues:
-            status = db.status.get(newstatus, 'name')
-        else:
-            status = 'new'
-        log = '[' + status + '] '
-    else:
-        log = ''
-    for msg in messages:
-        log += db.msg.get(msg, 'content')
-    if len(log) > max_content:
-        log = log[:max_content-4] + ' ...'
-    log = log.replace('\n', ' ')
-
-    params = parameters.copy()
-    params['file'] = cgi.escape(db.issue.get(nodeid, 'title'))
-    params['nodeid'] = nodeid
-    params['author'] = db.user.get(db.getuid(), 'username')
-    params['log'] = cgi.escape(log)
-
-    payload = TEMPLATE % params
-
-    try:
-        rpc = xmlrpclib.ServerProxy(server)
-        rpc.hub.deliver(payload)
-    except:
-        # Ignore any errors in sending the CIA;
-        # if the server is down, that's just bad luck
-        # XXX might want to do some logging here
-        pass
-
-def init(db):
-    db.issue.react('create', sendcia)
-    db.issue.react('set', sendcia)