annotate commitwatcher/event.py @ 44:4f8fe143b977

whitespace
author Jeff Hammel <jhammel@mozilla.com>
date Wed, 06 Nov 2013 23:08:20 -0800
parents 97dfcdeb9a4e
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
33
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
1 """
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
2 event system for watching commits
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
3 """
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
4
40
Jeff Hammel <jhammel@mozilla.com>
parents: 37
diff changeset
5 __all__ = ['EventHandler', 'PathEventHandler']
34
463dc92867df commitwatcher/event.py
Jeff Hammel <jhammel@mozilla.com>
parents: 33
diff changeset
6
33
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
7 class EventHandler(object):
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
8 """ABC for events"""
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
9
40
Jeff Hammel <jhammel@mozilla.com>
parents: 37
diff changeset
10 def __init__(self, *notifiers):
Jeff Hammel <jhammel@mozilla.com>
parents: 37
diff changeset
11 self.notifiers = list(notifiers)
Jeff Hammel <jhammel@mozilla.com>
parents: 37
diff changeset
12
34
463dc92867df commitwatcher/event.py
Jeff Hammel <jhammel@mozilla.com>
parents: 33
diff changeset
13 def match(self, commit):
463dc92867df commitwatcher/event.py
Jeff Hammel <jhammel@mozilla.com>
parents: 33
diff changeset
14 """does this event trigger the handler?"""
463dc92867df commitwatcher/event.py
Jeff Hammel <jhammel@mozilla.com>
parents: 33
diff changeset
15 return True # abstractmethod
463dc92867df commitwatcher/event.py
Jeff Hammel <jhammel@mozilla.com>
parents: 33
diff changeset
16
33
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
17 class PathEventHandler(EventHandler):
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
18 """events based on paths"""
34
463dc92867df commitwatcher/event.py
Jeff Hammel <jhammel@mozilla.com>
parents: 33
diff changeset
19
463dc92867df commitwatcher/event.py
Jeff Hammel <jhammel@mozilla.com>
parents: 33
diff changeset
20 def match(self, commit):
37
Jeff Hammel <jhammel@mozilla.com>
parents: 34
diff changeset
21 pass # TODO: move path handling -> commit object