[Python-checkins] r88789 - tracker/instances/python-dev/detectors/autonosy.py (original) (raw)
ezio.melotti python-checkins at python.org
Wed Mar 23 16:36:31 CET 2011
- Previous message: [Python-checkins] hooks: Use diffstat instead of ctx.files() to report summary of changed files.
- Next message: [Python-checkins] cpython: Issue #11244: Remove outdated peepholer check that was preventing the peepholer
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: ezio.melotti Date: Wed Mar 23 16:36:31 2011 New Revision: 88789
Log: #368: update the nosy list only when necessary.
Modified: tracker/instances/python-dev/detectors/autonosy.py
Modified: tracker/instances/python-dev/detectors/autonosy.py
--- tracker/instances/python-dev/detectors/autonosy.py (original) +++ tracker/instances/python-dev/detectors/autonosy.py Wed Mar 23 16:36:31 2011 @@ -1,5 +1,8 @@ -# Auditor to automatically add users as nosy to issues when -# the component field gets set +# This auditor automatically adds users and release managers to the nosy +# list when the component fields gets set and the priority is changed to +# 'release blocker' respectively. +# See also the nosyreaction.py script (they should probably be merged to a +# single script).
Python 2.3 ... 2.6 compatibility:
from roundup.anypy.sets_ import set @@ -14,19 +17,26 @@ def autonosy(db, cl, nodeid, newvalues): components = newvalues.get('components', [])
- nosy = set()
- current_nosy = set() if 'nosy' in newvalues:
new_nosy = newvalues.get('nosy', [])
new_nosy = [value for value in new_nosy if db.hasnode('user', value)]
nosy |= set(new_nosy)
# the nosy list changed
# newvalues['nosy'] contains all the user ids (new and old)
nosy = newvalues.get('nosy', [])
nosy = [value for value in nosy if db.hasnode('user', value)]
else: if nodeid:current_nosy |= set(nosy)
# the issue already exists
# get the values that were already in the nosy old_nosy = db.issue.get(nodeid, 'nosy')
nosy |= set(old_nosy)
current_nosy |= set(old_nosy)
make a copy of the current_nosy where to add the new user ids
new_nosy = set(current_nosy)
for component in components: users = db.component.get(component, 'add_as_nosy')
nosy |= set(users)
new_nosy |= set(users)
if 'priority' in newvalues: get the new values if they changed or the already-set ones if they didn't
@@ -49,9 +59,11 @@ for version in versions: name = db.version.get(version, 'name') if name in RELEASE_MANAGERS:
nosy.add(RELEASE_MANAGERS[name])
new_nosy.add(RELEASE_MANAGERS[name])
- newvalues['nosy'] = list(nosy)
- if current_nosy != new_nosy:
# some user ids have been added automatically, so update the nosy
newvalues['nosy'] = list(new_nosy)
def init(db):
- Previous message: [Python-checkins] hooks: Use diffstat instead of ctx.files() to report summary of changed files.
- Next message: [Python-checkins] cpython: Issue #11244: Remove outdated peepholer check that was preventing the peepholer
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]