changeset 20:a8e21cfda5fe

wip
author Jeff Hammel <jhammel@mozilla.com>
date Sun, 29 Sep 2013 20:23:51 -0700
parents 091fd9f40b05
children be7090ee7738
files commitwatcher/agent.py commitwatcher/commit.py commitwatcher/store.py
diffstat 3 files changed, 30 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/commitwatcher/agent.py	Sat Sep 28 20:33:17 2013 -0700
+++ b/commitwatcher/agent.py	Sun Sep 29 20:23:51 2013 -0700
@@ -42,11 +42,14 @@
         feed = feedparser.parse(self.feed())
         for entry in feed['entries']:
 
+            # get files from the changeset diff
             link = entry['link']
             files = self.files(link)
-            # TODO
 
-            # TODO            commit = Commit()
+            # make commit object
+            import pdb; pdb.set_trace()
+            commit = Commit()
+
 
 class FeedAgentDiff(FeedAgent):
     """read files from diff"""
@@ -71,7 +74,7 @@
                 a_b[i] = getattr(p, i)
 
                 # strip 'a/', 'b/' from front, just to make sure
-                # XXX because 
+                # XXX because the current version is b0rken sometimes
                 for prefix in ('a/', 'b/'):
                     if a_b[i].startswith(prefix):
                         a_b[i] = a_b[i][len(prefix):]
@@ -114,3 +117,6 @@
                               '\n'.join([('  %s' % path)
                                          for path in sorted(paths)]))
 
+
+class FeedAgentHTML(FeedAgent):
+    pass # TODO!
--- a/commitwatcher/commit.py	Sat Sep 28 20:33:17 2013 -0700
+++ b/commitwatcher/commit.py	Sun Sep 29 20:23:51 2013 -0700
@@ -4,11 +4,11 @@
 
 class Commit(object):
 
-    def __init__(self, message, datetime, author, paths, link=None, identity=None):
+    def __init__(self, message, datetime, author, paths, revision):
         self.message = message
         self.datetime = datetime
         self.author= author
         self.paths = paths
-        self.link = link
-        self.identity = identify
+        self.revision
 
+
--- a/commitwatcher/store.py	Sat Sep 28 20:33:17 2013 -0700
+++ b/commitwatcher/store.py	Sun Sep 29 20:23:51 2013 -0700
@@ -15,11 +15,23 @@
     def paths(self, *commits):
         """return all paths touched for a given commit"""
 
+    def ancestry(self, path):
+        sep = '/' # unix/url-style separators
+        path = path.split('/')
+        paths = []
+        while path:
+            paths.append(sep.join(path))
+            path.pop()
+        return paths
+
 
 class MemoryStore(CommitStore):
     """store in volatile memory"""
     # volatile!
 
+    def __init__(self):
+        self.path_to_commit = {}
+
     def add(self, commit):
         raise NotImplementedError()
 
@@ -27,3 +39,9 @@
         """
         return touched by commits
         """
+
+        paths = set()
+        for commit in commits:
+            for f in commit.files:
+                
+                raise NotImplementedError