annotate commitwatcher/event.py @ 35:5406eb70f5bd

example
author Jeff Hammel <jhammel@mozilla.com>
date Fri, 01 Nov 2013 09:23:46 -0700
parents 463dc92867df
children 798b747b65d6
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
34
463dc92867df commitwatcher/event.py
Jeff Hammel <jhammel@mozilla.com>
parents: 33
diff changeset
5 from abc import abstractmethod
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
34
463dc92867df commitwatcher/event.py
Jeff Hammel <jhammel@mozilla.com>
parents: 33
diff changeset
10 def match(self, commit):
463dc92867df commitwatcher/event.py
Jeff Hammel <jhammel@mozilla.com>
parents: 33
diff changeset
11 """does this event trigger the handler?"""
463dc92867df commitwatcher/event.py
Jeff Hammel <jhammel@mozilla.com>
parents: 33
diff changeset
12 return True # abstractmethod
463dc92867df commitwatcher/event.py
Jeff Hammel <jhammel@mozilla.com>
parents: 33
diff changeset
13
33
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
14 class PathEventHandler(EventHandler):
Jeff Hammel <jhammel@mozilla.com>
parents:
diff changeset
15 """events based on paths"""
34
463dc92867df commitwatcher/event.py
Jeff Hammel <jhammel@mozilla.com>
parents: 33
diff changeset
16
463dc92867df commitwatcher/event.py
Jeff Hammel <jhammel@mozilla.com>
parents: 33
diff changeset
17 def match(self, commit):
463dc92867df commitwatcher/event.py
Jeff Hammel <jhammel@mozilla.com>
parents: 33
diff changeset
18 pass # TODO: move path handling -> commit object