Rev 3303: * ``VersionedFile.get_graph_with_ghosts`` is deprecated, with no in http://people.ubuntu.com/~robertc/baz2.0/versioned_files
Robert Collins
robertc at robertcollins.net
Thu Mar 27 04:54:36 GMT 2008
At http://people.ubuntu.com/~robertc/baz2.0/versioned_files
------------------------------------------------------------
revno: 3303
revision-id: robertc at robertcollins.net-20080327045412-rju4uoh3glidd2px
parent: robertc at robertcollins.net-20080327041759-8b7gao08zdz99dei
committer: Robert Collins <robertc at robertcollins.net>
branch nick: versionedfile.apicleanup
timestamp: Thu 2008-03-27 15:54:12 +1100
message:
* ``VersionedFile.get_graph_with_ghosts`` is deprecated, with no
replacement method. The method was size(history) and not desirable.
(Robert Collins)
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/knit.py knit.py-20051212171256-f056ac8f0fbe1bd9
bzrlib/tests/interversionedfile_implementations/test_join.py test_join.py-20060302012326-9b5e9b0f0a03fedc
bzrlib/tests/test_knit.py test_knit.py-20051212171302-95d4c00dd5f11f2b
bzrlib/tests/test_versionedfile.py test_versionedfile.py-20060222045249-db45c9ed14a1c2e5
bzrlib/versionedfile.py versionedfile.py-20060222045106-5039c71ee3b65490
=== modified file 'NEWS'
--- a/NEWS 2008-03-27 01:25:24 +0000
+++ b/NEWS 2008-03-27 04:54:12 +0000
@@ -74,6 +74,10 @@
* ``VersionedFile.get_graph`` is deprecated, with no replacement method.
The method was size(history) and not desirable. (Robert Collins)
+ * ``VersionedFile.get_graph_with_ghosts`` is deprecated, with no
+ replacement method. The method was size(history) and not desirable.
+ (Robert Collins)
+
* ``VersionedFile.get_parents`` is deprecated, please use
``VersionedFile.get_parent_map``. (Robert Collins)
=== modified file 'bzrlib/knit.py'
--- a/bzrlib/knit.py 2008-03-27 04:17:59 +0000
+++ b/bzrlib/knit.py 2008-03-27 04:54:12 +0000
@@ -757,10 +757,10 @@
annotated_part = "plain"
return "knit-%s" % (annotated_part,)
+ @deprecated_method(one_four)
def get_graph_with_ghosts(self):
"""See VersionedFile.get_graph_with_ghosts()."""
- graph_items = self._index.get_graph()
- return dict(graph_items)
+ return self.get_parent_map(self.versions())
def get_sha1(self, version_id):
return self.get_sha1s([version_id])[0]
@@ -1433,10 +1433,6 @@
self._transport.put_bytes_non_atomic(
self._filename, self.HEADER, mode=self._file_mode)
- def get_graph(self):
- """Return a list of the node:parents lists from this knit index."""
- return [(vid, idx[4]) for vid, idx in self._cache.iteritems()]
-
def get_ancestry(self, versions, topo_sorted=True):
"""See VersionedFile.get_ancestry."""
# get a graph of all the mentioned versions:
@@ -1854,15 +1850,6 @@
else:
return 'fulltext'
- def get_graph(self):
- """Return a list of the node:parents lists from this knit index."""
- if not self._parents:
- return [(key, ()) for key in self.get_versions()]
- result = []
- for index, key, value, refs in self._graph_index.iter_all_entries():
- result.append((key[0], tuple([ref[0] for ref in refs[0]])))
- return result
-
def iter_parents(self, version_ids):
"""Iterate through the parents for many version ids.
=== modified file 'bzrlib/tests/interversionedfile_implementations/test_join.py'
--- a/bzrlib/tests/interversionedfile_implementations/test_join.py 2008-03-27 01:25:24 +0000
+++ b/bzrlib/tests/interversionedfile_implementations/test_join.py 2008-03-27 04:54:12 +0000
@@ -222,9 +222,8 @@
# ghost data should have been preserved
self.assertEqual(['base', 'notbase'], source.get_ancestry_with_ghosts(['notbase']))
self.assertEqual(['base'], source.get_parents_with_ghosts('notbase'))
- self.assertEqual({'notbase':('base',)}, source.get_parent_map(['notbase']))
- self.assertEqual({'notbase':('base',)}, source.get_graph_with_ghosts())
- self.assertTrue(source.has_ghost('base'))
+ self.assertEqual({'notbase':('base',)},
+ source.get_parent_map(source.versions()))
# if we add something that is fills out what is a ghost, then
# when joining into a ghost aware join it should flesh out the ghosts.
@@ -242,8 +241,7 @@
self.assertEqual({'base':(),
'notbase':('base',),
},
- target.get_graph_with_ghosts())
- self.assertFalse(target.has_ghost('base'))
+ source.get_parent_map(source.versions()))
def test_restricted_join_into_empty(self):
# joining into an empty versioned file with a version_ids list
=== modified file 'bzrlib/tests/test_knit.py'
--- a/bzrlib/tests/test_knit.py 2008-03-27 01:25:24 +0000
+++ b/bzrlib/tests/test_knit.py 2008-03-27 04:54:12 +0000
@@ -628,18 +628,6 @@
{}),
transport.calls.pop(0))
- def test_get_graph(self):
- transport = MockTransport()
- index = self.get_knit_index(transport, "filename", "w", create=True)
- self.assertEqual([], index.get_graph())
-
- index.add_version("a", ["option"], (None, 0, 1), ["b"])
- self.assertEqual([("a", ("b",))], index.get_graph())
-
- index.add_version("c", ["option"], (None, 0, 1), ["d"])
- self.assertEqual([("a", ("b",)), ("c", ("d",))],
- sorted(index.get_graph()))
-
def test_get_ancestry(self):
transport = MockTransport([
_KnitIndex.HEADER,
@@ -2291,15 +2279,6 @@
return KnitGraphIndex(combined_index, deltas=deltas,
add_callback=add_callback)
- def test_get_graph(self):
- index = self.two_graph_index()
- self.assertEqual(set([
- ('tip', ('parent', )),
- ('tail', ()),
- ('parent', ('tail', 'ghost')),
- ('separate', ()),
- ]), set(index.get_graph()))
-
def test_get_ancestry(self):
# get_ancestry is defined as eliding ghosts, not erroring.
index = self.two_graph_index()
@@ -2589,15 +2568,6 @@
return KnitGraphIndex(combined_index, parents=False,
add_callback=add_callback)
- def test_get_graph(self):
- index = self.two_graph_index()
- self.assertEqual(set([
- ('tip', ()),
- ('tail', ()),
- ('parent', ()),
- ('separate', ()),
- ]), set(index.get_graph()))
-
def test_get_ancestry(self):
# with no parents, ancestry is always just the key.
index = self.two_graph_index()
=== modified file 'bzrlib/tests/test_versionedfile.py'
--- a/bzrlib/tests/test_versionedfile.py 2008-03-27 01:25:24 +0000
+++ b/bzrlib/tests/test_versionedfile.py 2008-03-27 04:54:12 +0000
@@ -632,7 +632,6 @@
# check the other ghost apis are also not implemented
self.assertRaises(NotImplementedError, vf.get_ancestry_with_ghosts, ['foo'])
self.assertRaises(NotImplementedError, vf.get_parents_with_ghosts, 'foo')
- self.assertRaises(NotImplementedError, vf.get_graph_with_ghosts)
return
vf = self.reopen_file()
# test key graph related apis: getncestry, _graph, get_parents
@@ -646,7 +645,8 @@
# we have _with_ghost apis to give us ghost information.
self.assertEqual([parent_id_utf8, 'notbxbfse'], vf.get_ancestry_with_ghosts(['notbxbfse']))
self.assertEqual([parent_id_utf8], vf.get_parents_with_ghosts('notbxbfse'))
- self.assertEqual({'notbxbfse':(parent_id_utf8,)}, vf.get_graph_with_ghosts())
+ self.assertEqual({'notbxbfse':(parent_id_utf8,)},
+ self.applyDeprecated(one_four, vf.get_graph_with_ghosts))
self.assertTrue(self.applyDeprecated(one_four, vf.has_ghost,
parent_id_utf8))
# if we add something that is a ghost of another, it should correct the
@@ -667,7 +667,7 @@
self.assertEqual({parent_id_utf8:(),
'notbxbfse':(parent_id_utf8,),
},
- vf.get_graph_with_ghosts())
+ self.applyDeprecated(one_four, vf.get_graph_with_ghosts))
self.assertFalse(self.applyDeprecated(one_four, vf.has_ghost,
parent_id_utf8))
=== modified file 'bzrlib/versionedfile.py'
--- a/bzrlib/versionedfile.py 2008-03-27 01:25:24 +0000
+++ b/bzrlib/versionedfile.py 2008-03-27 04:54:12 +0000
@@ -385,6 +385,7 @@
pending.add(parent)
return result
+ @deprecated_method(one_four)
def get_graph_with_ghosts(self):
"""Return a graph for the entire versioned file.
More information about the bazaar-commits
mailing list