Rev 5566: (jelmer) Add GraphThunkIdsToKeys.add_node. (Jelmer Vernooij) in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Sun Dec 12 23:02:27 GMT 2010


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 5566 [merge]
revision-id: pqm at pqm.ubuntu.com-20101212230226-5qpi01ir8epiis70
parent: pqm at pqm.ubuntu.com-20101210150144-soij444ebu0ksoxu
parent: jelmer at samba.org-20101211220652-uc9awd3j3kcew75j
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Sun 2010-12-12 23:02:26 +0000
message:
  (jelmer) Add GraphThunkIdsToKeys.add_node. (Jelmer Vernooij)
modified:
  bzrlib/graph.py                graph_walker.py-20070525030359-y852guab65d4wtn0-1
  bzrlib/tests/test_graph.py     test_graph_walker.py-20070525030405-enq4r60hhi9xrujc-1
=== modified file 'bzrlib/graph.py'
--- a/bzrlib/graph.py	2010-08-15 15:20:14 +0000
+++ b/bzrlib/graph.py	2010-12-11 22:06:52 +0000
@@ -1770,6 +1770,9 @@
     def merge_sort(self, tip_revision):
         return self._graph.merge_sort((tip_revision,))
 
+    def add_node(self, revision, parents):
+        self._graph.add_node((revision,), [(p,) for p in parents])
+
 
 _counters = [0,0,0,0,0,0,0]
 try:

=== modified file 'bzrlib/tests/test_graph.py'
--- a/bzrlib/tests/test_graph.py	2010-08-15 15:20:14 +0000
+++ b/bzrlib/tests/test_graph.py	2010-12-11 22:06:52 +0000
@@ -1654,6 +1654,14 @@
         self.assertEqual(['D'], sorted(graph_thunk.heads(['D', 'C'])))
         self.assertEqual(['B', 'C'], sorted(graph_thunk.heads(['B', 'C'])))
 
+    def test_add_node(self):
+        d = {('C',):[('A',)], ('B',): [('A',)], ('A',): []}
+        g = _mod_graph.KnownGraph(d)
+        graph_thunk = _mod_graph.GraphThunkIdsToKeys(g)
+        graph_thunk.add_node("D", ["A", "C"])
+        self.assertEqual(['B', 'D'],
+            sorted(graph_thunk.heads(['D', 'B', 'A'])))
+
 
 class TestPendingAncestryResultGetKeys(TestCaseWithMemoryTransport):
     """Tests for bzrlib.graph.PendingAncestryResult."""




More information about the bazaar-commits mailing list