diff 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
line wrap: on
line diff
--- a/commitwatcher/agent.py	Thu Sep 26 05:11:57 2013 -0700
+++ b/commitwatcher/agent.py	Thu Sep 26 21:35:29 2013 -0700
@@ -2,11 +2,39 @@
 agents to gather commits
 """
 
+import feedparser
+from .commit import Commit
+
 class Agent(object):
     """abstract base class"""
 
+    def __init__(self, repository, store):
+        """
+        repository -- repo to monitor
+        """
+        self.repository = repository
+        self.store = store
+
+
 class LocalCheckoutAgent(object):
     """agent based on local checkouts"""
 
+
 class FeedAgent(Agent):
     """gathers changesets by reading RSS/Atom"""
+
+    def feed(self):
+        """feed URL"""
+        return '/'.join((self.repository.rstrip('/'), 'atom-log'))
+
+    def update(self):
+        """update"""
+
+        feed = feedparser.parse(self.feed())
+        for entry in feedparser['entries']:
+
+            # get paths from diff
+            link = entry['link']
+            # TODO
+
+            commit = Commit()