Add utility functions to DictRefsContainer, useful for tests.
authorDave Borowitz <dborowitz@google.com>
Wed, 11 Aug 2010 21:45:03 +0000 (23:45 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Wed, 11 Aug 2010 21:45:03 +0000 (23:45 +0200)
NEWS
dulwich/repo.py

diff --git a/NEWS b/NEWS
index 7a1b61c6032e294af2d22d57683cf11a50be5fd2..97e436edc14175a469321aa236c55b43f39d1c11 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -69,6 +69,8 @@
   * Explicitly specify allowed protocol commands to
     ProtocolGraphWalker.read_proto_line.  (Dave Borowitz)
 
+  * Add utility functions to DictRefsContainer. (Dave Borowitz)
+
 
 0.6.1  2010-07-22
 
index 335c1be32bd94acd6618e2c9c29424a74de31247..54a554684aea08b8d7c4753ff427445cb2ee0cf5 100644 (file)
@@ -342,6 +342,7 @@ class DictRefsContainer(RefsContainer):
 
     def __init__(self, refs):
         self._refs = refs
+        self._peeled = {}
 
     def allkeys(self):
         return self._refs.keys()
@@ -374,6 +375,19 @@ class DictRefsContainer(RefsContainer):
         del self._refs[name]
         return True
 
+    def get_peeled(self, name):
+        return self._peeled.get(name)
+
+    def _update(self, refs):
+        """Update multiple refs; intended only for testing."""
+        # TODO(dborowitz): replace this with a public function that uses
+        # set_if_equal.
+        self._refs.update(refs)
+
+    def _update_peeled(self, peeled):
+        """Update cached peeled refs; intended only for testing."""
+        self._peeled.update(peeled)
+
 
 class DiskRefsContainer(RefsContainer):
     """Refs container that reads refs from disk."""