comparison commitwatcher/agent.py @ 2:4cb3971d9d9d

commitwatcher/__init__.py commitwatcher/agent.py commitwatcher/main.py setup.py commitwatcher/commit.py commitwatcher/store.py mozbasewatcher.py
author Jeff Hammel <jhammel@mozilla.com>
date Thu, 26 Sep 2013 21:35:29 -0700
parents 4e24f3c6610c
children 883c88b13142
comparison
equal deleted inserted replaced
1:4e24f3c6610c 2:4cb3971d9d9d
1 """ 1 """
2 agents to gather commits 2 agents to gather commits
3 """ 3 """
4 4
5 import feedparser
6 from .commit import Commit
7
5 class Agent(object): 8 class Agent(object):
6 """abstract base class""" 9 """abstract base class"""
10
11 def __init__(self, repository, store):
12 """
13 repository -- repo to monitor
14 """
15 self.repository = repository
16 self.store = store
17
7 18
8 class LocalCheckoutAgent(object): 19 class LocalCheckoutAgent(object):
9 """agent based on local checkouts""" 20 """agent based on local checkouts"""
10 21
22
11 class FeedAgent(Agent): 23 class FeedAgent(Agent):
12 """gathers changesets by reading RSS/Atom""" 24 """gathers changesets by reading RSS/Atom"""
25
26 def feed(self):
27 """feed URL"""
28 return '/'.join((self.repository.rstrip('/'), 'atom-log'))
29
30 def update(self):
31 """update"""
32
33 feed = feedparser.parse(self.feed())
34 for entry in feedparser['entries']:
35
36 # get paths from diff
37 link = entry['link']
38 # TODO
39
40 commit = Commit()