dulwich-users team mailing list archive
-
dulwich-users team
-
Mailing list archive
-
Message #00176
[PATCH 02/10] Add utility functions to DictRefsContainer, useful for tests.
From: Dave Borowitz <dborowitz@xxxxxxxxxx>
Change-Id: I51555cfabebbe6e1fee0f0129b3c40ed191276d9
---
NEWS | 2 ++
dulwich/repo.py | 14 ++++++++++++++
2 files changed, 16 insertions(+), 0 deletions(-)
diff --git a/NEWS b/NEWS
index 14e067c..8ed25cc 100644
--- a/NEWS
+++ b/NEWS
@@ -43,6 +43,8 @@
* Tweak server handler injection. (Dave Borowitz)
+ * Add utility functions to DictRefsContainer. (Dave Borowitz)
+
0.6.1 2010-07-22
diff --git a/dulwich/repo.py b/dulwich/repo.py
index b53ee74..6b1d9d8 100644
--- a/dulwich/repo.py
+++ b/dulwich/repo.py
@@ -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."""
--
1.7.1
References