Mercurial > hg > CommitWatcher
comparison 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 |
comparison
equal
deleted
inserted
replaced
9:08dd6fbbec3a | 10:7ae60d2ff1c2 |
---|---|
1 """ | 1 """ |
2 agents to gather commits | 2 agents to gather commits |
3 """ | 3 """ |
4 | 4 |
5 import feedparser | 5 import feedparser |
6 from abc import abstractmethod | |
6 from .commit import Commit | 7 from .commit import Commit |
7 from .store import MemoryStore | 8 from .store import MemoryStore |
8 | 9 |
9 class Agent(object): | 10 class Agent(object): |
10 """abstract base class""" | 11 """abstract base class""" |
36 """update""" | 37 """update""" |
37 | 38 |
38 feed = feedparser.parse(self.feed()) | 39 feed = feedparser.parse(self.feed()) |
39 for entry in feed['entries']: | 40 for entry in feed['entries']: |
40 | 41 |
41 # get paths from diff | |
42 link = entry['link'] | 42 link = entry['link'] |
43 print link | |
44 files = self.files(link) | 43 files = self.files(link) |
45 # TODO | 44 # TODO |
46 | 45 |
47 # TODO commit = Commit() | 46 # TODO commit = Commit() |
47 | |
48 class FeedAgentDiff(FeedAgent): | |
49 """read files from diff""" | |
50 | |
51 def diff_url(self, link): | |
52 """ | |
53 returns diff_url from revision link: | |
54 | |
55 >>> diff_url('http://hg.mozilla.org/mozilla-central/rev/4e1a3919e741') | |
56 'http://hg.mozilla.org/mozilla-central/raw-rev/4e1a3919e741' | |
57 """ | |
58 return '/raw-rev/'.join(link.rsplit('/rev/', 1)) | |
59 | |
60 def files(self, revision): | |
61 """ | |
62 revision -- revision link | |
63 """ | |
64 | |
65 raw_rev = self.diff_url(revision) | |
66 print raw_rev | |
67 | |
68 # get paths from diff |