Rev 3332: (robertc) Remove VersionedFile.create_empty - it is incompatible with in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Fri Apr 4 02:39:23 BST 2008


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

------------------------------------------------------------
revno: 3332
revision-id:pqm at pqm.ubuntu.com-20080404013911-s5ozllh7002ymmdt
parent: pqm at pqm.ubuntu.com-20080403080121-tbx3clqp8wqe776c
parent: robertc at robertcollins.net-20080404000223-m270i246sp9uatmt
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2008-04-04 02:39:11 +0100
message:
  (robertc) Remove VersionedFile.create_empty - it is incompatible with
  	stacking api needs. (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
    ------------------------------------------------------------
    revno: 3316.2.2
    revision-id:robertc at robertcollins.net-20080404000223-m270i246sp9uatmt
    parent: robertc at robertcollins.net-20080401024125-r3xmxj0wwt5sm4f9
    parent: pqm at pqm.ubuntu.com-20080403080121-tbx3clqp8wqe776c
    committer: Robert Collins <robertc at robertcollins.net>
    branch nick: integration
    timestamp: Fri 2008-04-04 11:02:23 +1100
    message:
      Fix conflicts.
    added:
      bzrlib/transport/nosmart.py    nosmart.py-20080402095843-6ib17idympwy1zkr-1
    renamed:
      bzrlib/tests/test_revisionnamespaces.py => bzrlib/tests/test_revisionspec.py testrevisionnamespaces.py-20050711050225-8b4af89e6b1efe84
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzr                            bzr.py-20050313053754-5485f144c7006fa6
      bzrlib/branch.py               branch.py-20050309040759-e4baf4e0d046576e
      bzrlib/bugtracker.py           bugtracker.py-20070410073305-vu1vu1qosjurg8kb-1
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/bzrdir.py               bzrdir.py-20060131065624-156dfea39c4387cb
      bzrlib/config.py               config.py-20051011043216-070c74f4e9e338e8
      bzrlib/doc/api/__init__.py     __init__.py-20051224020744-7b87d590843855bc
      bzrlib/errors.py               errors.py-20050309040759-20512168c4e14fbd
      bzrlib/help_topics/__init__.py help_topics.py-20060920210027-rnim90q9e0bwxvy4-1
      bzrlib/mail_client.py          mail_client.py-20070809192806-vuxt3t19srtpjpdn-1
      bzrlib/plugins/launchpad/lp_directory.py lp_indirect.py-20070126012204-de5rugwlt22c7u7e-1
      bzrlib/remote.py               remote.py-20060720103555-yeeg2x51vn0rbtdp-1
      bzrlib/revisionspec.py         revisionspec.py-20050907152633-17567659fd5c0ddb
      bzrlib/smart/branch.py         branch.py-20061124031907-mzh3pla28r83r97f-1
      bzrlib/smart/bzrdir.py         bzrdir.py-20061122024551-ol0l0o0oofsu9b3t-1
      bzrlib/smart/client.py         client.py-20061116014825-2k6ada6xgulslami-1
      bzrlib/smart/medium.py         medium.py-20061103051856-rgu2huy59fkz902q-1
      bzrlib/smart/protocol.py       protocol.py-20061108035435-ot0lstk2590yqhzr-1
      bzrlib/smart/repository.py     repository.py-20061128022038-vr5wy5bubyb8xttk-1
      bzrlib/smart/request.py        request.py-20061108095550-gunadhxmzkdjfeek-1
      bzrlib/smart/server.py         server.py-20061110062051-chzu10y32vx8gvur-1
      bzrlib/smart/vfs.py            vfs.py-20061108095550-gunadhxmzkdjfeek-2
      bzrlib/status.py               status.py-20050505062338-431bfa63ec9b19e6
      bzrlib/tests/TestUtil.py       TestUtil.py-20050824080200-5f70140a2d938694
      bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
      bzrlib/tests/blackbox/test_version.py test_version.py-20070312060045-ol7th9z035r3im3d-1
      bzrlib/tests/interrepository_implementations/__init__.py __init__.py-20060220054744-baf49a1f88f17b1a
      bzrlib/tests/interrepository_implementations/test_interrepository.py test_interrepository.py-20060220061411-1ec13fa99e5e3eee
      bzrlib/tests/test_bugtracker.py test_bugtracker.py-20070410073305-vu1vu1qosjurg8kb-2
      bzrlib/tests/test_errors.py    test_errors.py-20060210110251-41aba2deddf936a8
      bzrlib/tests/test_lazy_import.py test_lazy_import.py-20060910203832-f77c54gf3n232za0-2
      bzrlib/tests/test_mail_client.py test_mail_client.py-20070809192806-vuxt3t19srtpjpdn-2
      bzrlib/tests/test_remote.py    test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
      bzrlib/tests/test_selftest.py  test_selftest.py-20051202044319-c110a115d8c0456a
      bzrlib/tests/test_smart.py     test_smart.py-20061122024551-ol0l0o0oofsu9b3t-2
      bzrlib/tests/test_smart_transport.py test_ssh_transport.py-20060608202016-c25gvf1ob7ypbus6-2
      bzrlib/tests/test_status.py    test_status.py-20060516190614-fbf6432e4a6e8aa5
      bzrlib/tests/test_transport_implementations.py test_transport_implementations.py-20051227111451-f97c5c7d5c49fce7
      bzrlib/tests/test_wsgi.py      test_wsgi.py-20061005091552-rz8pva0olkxv0sd8-1
      bzrlib/transport/__init__.py   transport.py-20050711165921-4978aa7ce1285ad5
      bzrlib/transport/chroot.py     chroot.py-20061011104729-0us9mgm97z378vnt-1
      bzrlib/transport/ftp.py        ftp.py-20051116161804-58dc9506548c2a53
      bzrlib/transport/http/wsgi.py  wsgi.py-20061005091552-rz8pva0olkxv0sd8-2
      bzrlib/transport/remote.py     ssh.py-20060608202016-c25gvf1ob7ypbus6-1
      doc/en/user-guide/http_smart_server.txt fastcgi.txt-20061005091552-rz8pva0olkxv0sd8-3
      bzrlib/tests/test_revisionspec.py testrevisionnamespaces.py-20050711050225-8b4af89e6b1efe84
    ------------------------------------------------------------
    revno: 3316.2.1
    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-04-03 08:01:21 +0000
+++ b/NEWS	2008-04-04 00:02:23 +0000
@@ -119,6 +119,10 @@
     * ``Transport.get_shared_medium`` is deprecated.  Use
       ``Transport.get_smart_medium`` instead.  (Andrew Bennetts)
 
+    * ``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