Mercurial > hg > CommitWatcher
view commitwatcher/agent.py @ 9:08dd6fbbec3a
commitwatcher/agent.py
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Fri, 27 Sep 2013 14:23:53 -0700 |
parents | 2061b13f7aad |
children | 7ae60d2ff1c2 |
line wrap: on
line source
""" agents to gather commits """ import feedparser from .commit import Commit from .store import MemoryStore class Agent(object): """abstract base class""" def __init__(self, repository, store=None): """ repository -- repo to monitor """ self.repository = repository self.store = MemoryStore() if store is None else 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')) @abstractmethod def files(self, revision): """gets the files from the revision link""" def update(self): """update""" feed = feedparser.parse(self.feed()) for entry in feed['entries']: # get paths from diff link = entry['link'] print link files = self.files(link) # TODO # TODO commit = Commit()