Mercurial > hg > CommitWatcher
diff commitwatcher/agent.py @ 10:7ae60d2ff1c2
commitwatcher/agent.py mozbasewatcher.py tests/41701d2c0341.diff
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Sat, 28 Sep 2013 05:10:14 -0700 |
parents | 08dd6fbbec3a |
children | 546695da018c |
line wrap: on
line diff
--- a/commitwatcher/agent.py Fri Sep 27 14:23:53 2013 -0700 +++ b/commitwatcher/agent.py Sat Sep 28 05:10:14 2013 -0700 @@ -3,6 +3,7 @@ """ import feedparser +from abc import abstractmethod from .commit import Commit from .store import MemoryStore @@ -38,10 +39,30 @@ 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() + +class FeedAgentDiff(FeedAgent): + """read files from diff""" + + def diff_url(self, link): + """ + returns diff_url from revision link: + + >>> diff_url('http://hg.mozilla.org/mozilla-central/rev/4e1a3919e741') + 'http://hg.mozilla.org/mozilla-central/raw-rev/4e1a3919e741' + """ + return '/raw-rev/'.join(link.rsplit('/rev/', 1)) + + def files(self, revision): + """ + revision -- revision link + """ + + raw_rev = self.diff_url(revision) + print raw_rev + + # get paths from diff