From: Eric S. Raymond Date: Thu, 4 Oct 2012 04:23:24 +0000 (-0400) Subject: Back out laurentb's filtering - good idea, but not ready for a stable release. X-Git-Tag: 1.6~3 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=45ccfe8a7ff9af681cd4ab93b4e421acddf716bd;p=irker.git Back out laurentb's filtering - good idea, but not ready for a stable release. --- diff --git a/NEWS b/NEWS index d9afdcd..ba4881c 100644 --- a/NEWS +++ b/NEWS @@ -4,7 +4,6 @@ In 1.5 trying to appease pylint broke the Mercurial hook. Added credits for contributors in hacking.txt. Fix the aging out of connections when we hit a resource limit. - Add option for external filtering. 1.5 @ 2012-10-03 Mercurial support. diff --git a/irkerhook.py b/irkerhook.py index 239fbef..96d6de2 100755 --- a/irkerhook.py +++ b/irkerhook.py @@ -368,11 +368,6 @@ def ship(extractor, commit, debug): "Ship a notification for the specified commit." metadata = extractor.commit_factory(commit) - # Run through an external filter if required. - channels = extractor.channels.split(",") - if extractor.filtercmd: - channels = filterc(extractor.filtercmd, channels, metadata) or [] - # Message reduction. The assumption here is that IRC can't handle # lines more than 510 characters long. If we exceed that length, we # try knocking out the file list, on the theory that for notification @@ -385,6 +380,7 @@ def ship(extractor, commit, debug): privmsg = str(metadata) # Anti-spamming guard. + channels = extractor.channels.split(",") if extractor.maxchannels != 0: channels = channels[:extractor.maxchannels] diff --git a/irkerhook.xml b/irkerhook.xml index a44c4f2..e10d5b8 100644 --- a/irkerhook.xml +++ b/irkerhook.xml @@ -296,33 +296,6 @@ exists. -Filtering - -It is possible to filter commits before sending them to irkerd. - -You have to specify the option, which will be the command irkerhook.py will run. This command should accept two arguments: the first one being the commit metadata, the second one being the channel list. The command should then return a tuple, with the new channel list then an optional list of commit metadata updates. - -Below is an example filter: - - -#!/usr/bin/env python -import sys, json -channels = json.loads(sys.argv[1]) -commit = json.loads(sys.argv[2]) -update = {} -# we have two bobs in the project -if commit.get("mail", "") == "bob@foo": - update["author"] = "bobm" -if commit.get("mail", "") == "bob@bar": - update["author"] = "bobp" -# ignore some commits -if 'automated commit' in commit['logmsg']: - channels = [] -print json.dumps([channels, update]) - - - - OPTIONS