Rev 3317: * ``VersionedFile.create_empty`` is removed. This method presupposed a in http://people.ubuntu.com/~robertc/baz2.0/versioned_files
Robert Collins
robertc at robertcollins.net
Tue Apr 1 03:42:58 BST 2008
At http://people.ubuntu.com/~robertc/baz2.0/versioned_files
------------------------------------------------------------
revno: 3317
revision-id: robertc at robertcollins.net-20080401024125-r3xmxj0wwt5sm4f9
parent: pqm at pqm.ubuntu.com-20080330070256-7jn50o1dkbqbtvsh
committer: Robert Collins <robertc at robertcollins.net>
branch nick: api-cleanup
timestamp: Tue 2008-04-01 13:41:25 +1100
message:
* ``VersionedFile.create_empty`` is removed. This method presupposed a
sensible mapping to a transport for individual files, but pack backed
versioned files have no such mapping. (Robert Collins)
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/knit.py knit.py-20051212171256-f056ac8f0fbe1bd9
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
bzrlib/weave.py knit.py-20050627021749-759c29984154256b
=== modified file 'NEWS'
--- a/NEWS 2008-03-28 07:24:55 +0000
+++ b/NEWS 2008-04-01 02:41:25 +0000
@@ -82,6 +82,10 @@
* ``revision.revision_graph`` is deprecated, with no replacement function.
The function was size(history) and not desirable. (Robert Collins)
+ * ``VersionedFile.create_empty`` is removed. This method presupposed a
+ sensible mapping to a transport for individual files, but pack backed
+ versioned files have no such mapping. (Robert Collins)
+
* ``VersionedFile.get_graph`` is deprecated, with no replacement method.
The method was size(history) and not desirable. (Robert Collins)
=== modified file 'bzrlib/knit.py'
--- a/bzrlib/knit.py 2008-03-27 04:54:12 +0000
+++ b/bzrlib/knit.py 2008-04-01 02:41:25 +0000
@@ -632,10 +632,6 @@
# move the copied index into place
transport.move(name + INDEX_SUFFIX + '.tmp', name + INDEX_SUFFIX)
- def create_empty(self, name, transport, mode=None):
- return KnitVersionedFile(name, transport, factory=self.factory,
- delta=self.delta, create=True)
-
def get_data_stream(self, required_versions):
"""Get a data stream for the specified versions.
=== modified file 'bzrlib/tests/test_knit.py'
--- a/bzrlib/tests/test_knit.py 2008-03-27 04:54:12 +0000
+++ b/bzrlib/tests/test_knit.py 2008-04-01 02:41:25 +0000
@@ -1433,15 +1433,6 @@
instrumented_t._activity)
self.assertEqual([('text\n', 'base'), ('text2\n', 'base2')], results)
- def test_create_empty_annotated(self):
- k1 = self.make_test_knit(True)
- # 0
- k1.add_lines('text-a', [], ['a\n', 'b\n'])
- k2 = k1.create_empty('t', MemoryTransport())
- self.assertTrue(isinstance(k2.factory, KnitAnnotateFactory))
- self.assertEqual(k1.delta, k2.delta)
- # the generic test checks for empty content and file class
-
def test_knit_format(self):
# this tests that a new knit index file has the expected content
# and that is writes the data we expect as records are added.
=== modified file 'bzrlib/tests/test_versionedfile.py'
--- a/bzrlib/tests/test_versionedfile.py 2008-03-27 04:54:12 +0000
+++ b/bzrlib/tests/test_versionedfile.py 2008-04-01 02:41:25 +0000
@@ -379,15 +379,6 @@
verify_file(f)
verify_file(self.reopen_file())
- def test_create_empty(self):
- f = self.get_file()
- f.add_lines('0', [], ['a\n'])
- new_f = f.create_empty('t', MemoryTransport())
- # smoke test, specific types should check it is honoured correctly for
- # non type attributes
- self.assertEqual([], new_f.versions())
- self.assertTrue(isinstance(new_f, f.__class__))
-
def test_copy_to(self):
f = self.get_file()
f.add_lines('0', [], ['a\n'])
=== modified file 'bzrlib/versionedfile.py'
--- a/bzrlib/versionedfile.py 2008-03-27 04:54:12 +0000
+++ b/bzrlib/versionedfile.py 2008-04-01 02:41:25 +0000
@@ -197,15 +197,6 @@
"""Helper function to do the _clone_text work."""
raise NotImplementedError(self.clone_text)
- def create_empty(self, name, transport, mode=None):
- """Create a new versioned file of this exact type.
-
- :param name: the file name
- :param transport: the transport
- :param mode: optional file mode.
- """
- raise NotImplementedError(self.create_empty)
-
def get_format_signature(self):
"""Get a text description of the data encoding in this file.
@@ -765,18 +756,7 @@
are not present in the other file's history unless ignore_missing is
supplied in which case they are silently skipped.
"""
- # the default join:
- # - if the target is empty, just add all the versions from
- # source to target, otherwise:
- # - make a temporary versioned file of type target
- # - insert the source content into it one at a time
- # - join them
- if not self.target.versions():
- target = self.target
- else:
- # Make a new target-format versioned file.
- temp_source = self.target.create_empty("temp", MemoryTransport())
- target = temp_source
+ target = self.target
version_ids = self._get_source_version_ids(version_ids, ignore_missing)
graph = Graph(self.source)
search = graph._make_breadth_first_searcher(version_ids)
@@ -803,21 +783,14 @@
total = len(order)
for index, version in enumerate(order):
pb.update('Converting versioned data', index, total)
+ if version in target:
+ continue
_, _, parent_text = target.add_lines(version,
parent_map[version],
self.source.get_lines(version),
parent_texts=parent_texts)
parent_texts[version] = parent_text
-
- # this should hit the native code path for target
- if target is not self.target:
- return self.target.join(temp_source,
- pb,
- msg,
- version_ids,
- ignore_missing)
- else:
- return total
+ return total
finally:
pb.finished()
=== modified file 'bzrlib/weave.py'
--- a/bzrlib/weave.py 2008-03-25 00:52:16 +0000
+++ b/bzrlib/weave.py 2008-04-01 02:41:25 +0000
@@ -904,9 +904,6 @@
sio.seek(0)
transport.put_file(name + WeaveFile.WEAVE_SUFFIX, sio, self._filemode)
- def create_empty(self, name, transport, filemode=None):
- return WeaveFile(name, transport, filemode, create=True)
-
def _save(self):
"""Save the weave."""
self._check_write_ok()
More information about the bazaar-commits
mailing list