changeset 31:3edb91cfd3c1

move to ABC
author Jeff Hammel <jhammel@mozilla.com>
date Fri, 11 Oct 2013 10:19:47 -0700
parents 4c53f4cc6ffe
children 630aaf102ce8
files commitwatcher/store.py
diffstat 1 files changed, 15 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/commitwatcher/store.py	Wed Oct 09 14:50:07 2013 -0700
+++ b/commitwatcher/store.py	Fri Oct 11 10:19:47 2013 -0700
@@ -37,6 +37,17 @@
             path.pop()
         return paths
 
+    def paths(self, *commits):
+        """
+        return paths touched by commits
+        """
+
+        paths = set()
+        for commit in commits:
+            for f in commit.files:
+                paths.update(self.ancestry(f))
+        return paths
+
 
 class MemoryStore(CommitStore):
     """store in volatile memory"""
@@ -46,18 +57,9 @@
         self.path_to_commit = {}
         self._commits = []
 
-    def add(self, commit):
+    def store(self, commit):
+        paths = self.paths(commit)
+        for path in paths:
+        self.path_to_commit.set_default(path, []).append(commit)
         raise NotImplementedError()
 
-    def paths(self, *commits):
-        """
-        return paths touched by commits
-        """
-
-        paths = set()
-        for commit in commits:
-            for f in commit.files:
-                for path in self.ancestry(f):
-                    self.path_to_commit.set_default(path, []).append(commit)
-                    # TODO: worry about commit order
-