Add .changed() support to VCS
authorW. Trevor King <wking@drexel.edu>
Mon, 18 Jan 2010 13:06:08 +0000 (08:06 -0500)
committerW. Trevor King <wking@drexel.edu>
Mon, 18 Jan 2010 13:06:08 +0000 (08:06 -0500)
libbe/storage/vcs/base.py

index 8390cbce4cd90a79b68f898457fc81800745ef0a..e837780c1a57898dae1dcbfcbec349c333bfb20f 100644 (file)
@@ -597,6 +597,14 @@ os.listdir(self.get_path("bugs")):
         """
         return None
 
+    def _vcs_changed(self, revision):
+        """
+        Return a tuple of lists of ids
+          (new, modified, removed)
+        from the specified revision to the current situation.
+        """
+        return ([], [], [])
+
     def version(self):
         # Cache version string for efficiency.
         if not hasattr(self, '_version'):
@@ -839,6 +847,13 @@ os.listdir(self.get_path("bugs")):
             raise libbe.storage.base.InvalidRevision(index)
         return revid
 
+    def changed(self, revision):
+        new,mod,rem = self._vcs_changed(revision)
+        new = [self._u_path_to_id(p) for p in new]
+        mod = [self._u_path_to_id(p) for p in mod]
+        rem = [self._u_path_to_id(p) for p in rem]
+        return (new, mod, rem)
+
     def _u_any_in_string(self, list, string):
         """
         Return True if any of the strings in list are in string.