Remove duplicate definition of CachingParentsProvider.
authorJelmer Vernooij <jelmer@samba.org>
Mon, 24 Mar 2008 17:40:04 +0000 (18:40 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Mon, 24 Mar 2008 17:40:04 +0000 (18:40 +0100)
graph.py
repository.py

index eefe12bcc03a0b4151b57417a7fbecb396940d29..47f8197a1d7e53a232780ed50be385cb687dd3e8 100644 (file)
--- a/graph.py
+++ b/graph.py
@@ -66,47 +66,6 @@ class CachingParentsProvider(object):
         return parent_map
 
 
-class CachingParentsProvider(object):
-    """A parents provider which will cache the revision => parents in a dict.
-
-    This is useful for providers that have an expensive lookup.
-    """
-
-    def __init__(self, parent_provider):
-        self._real_provider = parent_provider
-        # Theoretically we could use an LRUCache here
-        self._cache = {}
-
-    def __repr__(self):
-        return "%s(%r)" % (self.__class__.__name__, self._real_provider)
-
-    def get_parent_map(self, keys):
-        """See _StackedParentsProvider.get_parent_map"""
-        needed = set()
-        # If the _real_provider doesn't have a key, we cache a value of None,
-        # which we then later use to realize we cannot provide a value for that
-        # key.
-        parent_map = {}
-        cache = self._cache
-        for key in keys:
-            if key in cache:
-                value = cache[key]
-                if value is not None:
-                    parent_map[key] = value
-            else:
-                needed.add(key)
-
-        if needed:
-            new_parents = self._real_provider.get_parent_map(needed)
-            cache.update(new_parents)
-            parent_map.update(new_parents)
-            needed.difference_update(new_parents)
-            cache.update(dict.fromkeys(needed, None))
-        return parent_map
-
-
-
-
 class Graph(graph.Graph):
     def __init__(self, parents_provider):
         graph.Graph.__init__(self, parents_provider)
index 533380cb317575f0a0194e6e8ea83e83331ba3fe..aa39ac993a5ba3941d087b983626ff6a53b13b0b 100644 (file)
@@ -705,7 +705,10 @@ class SvnRepository(Repository):
 
     def get_lhs_parent(self, revid):
         (branch_path, revnum, mapping) = self.lookup_revision_id(revid)
-        return lhs_revision_parent(branch_path, revnum, mapping)
+        parent_revid = self.lhs_revision_parent(branch_path, revnum, mapping)
+        if parent_revid is None:
+            return NULL_REVISION
+        return parent_revid
 
     def follow_branch(self, branch_path, revnum, mapping):
         """Follow the history of a branch. Will yield all the