Rev 3512: (bialix) Deprectate (Branch|Repository).print_file, fix cmd_cat in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Thu Jun 26 01:42:51 BST 2008


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

------------------------------------------------------------
revno: 3512
revision-id:pqm at pqm.ubuntu.com-20080626004245-dnw85so4xqg8r9hy
parent: pqm at pqm.ubuntu.com-20080625230724-lyux37pu8nx8tq34
parent: aaron at aaronbentley.com-20080626001706-wo3w74fwgliy12s4
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Thu 2008-06-26 01:42:45 +0100
message:
  (bialix) Deprectate (Branch|Repository).print_file, fix cmd_cat
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
  bzrlib/tree.py                 tree.py-20050309040759-9d5f2496be663e77
    ------------------------------------------------------------
    revno: 3511.1.2
    revision-id:aaron at aaronbentley.com-20080626001706-wo3w74fwgliy12s4
    parent: aaron at aaronbentley.com-20080626001355-gzj1nnjzlo6z6rrd
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: bzr.ab.integration
    timestamp: Wed 2008-06-25 20:17:06 -0400
    message:
      Update text and deprecation symbols.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/tree.py                 tree.py-20050309040759-9d5f2496be663e77
    ------------------------------------------------------------
    revno: 3511.1.1
    revision-id:aaron at aaronbentley.com-20080626001355-gzj1nnjzlo6z6rrd
    parent: pqm at pqm.ubuntu.com-20080625230724-lyux37pu8nx8tq34
    parent: bialix at ukr.net-20080407074946-wlhszbw47p45rjof
    committer: Aaron Bentley <aaron at aaronbentley.com>
    branch nick: bzr.ab.integration
    timestamp: Wed 2008-06-25 20:13:55 -0400
    message:
      Merge cat fixes
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/tree.py                 tree.py-20050309040759-9d5f2496be663e77
    ------------------------------------------------------------
    revno: 3341.2.2
    revision-id:bialix at ukr.net-20080407074946-wlhszbw47p45rjof
    parent: bialix at ukr.net-20080407074826-5lwuyv4dn1qlijg4
    committer: Alexander Belchenko <bialix at ukr.net>
    branch nick: cmd-cat
    timestamp: Mon 2008-04-07 10:49:46 +0300
    message:
      Tree.print_file and Repository.print_file are deprecated.
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/repository.py           rev_storage.py-20051111201905-119e9401e46257e3
      bzrlib/tree.py                 tree.py-20050309040759-9d5f2496be663e77
    ------------------------------------------------------------
    revno: 3341.2.1
    revision-id:bialix at ukr.net-20080407074826-5lwuyv4dn1qlijg4
    parent: pqm at pqm.ubuntu.com-20080407044456-s1a9orh0kssphdh9
    committer: Alexander Belchenko <bialix at ukr.net>
    branch nick: cmd-cat
    timestamp: Mon 2008-04-07 10:48:26 +0300
    message:
      `bzr cat` no more internally used Tree.print_file().
    modified:
      NEWS                           NEWS-20050323055033-4e00b5db738777ff
      bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
=== modified file 'NEWS'
--- a/NEWS	2008-06-25 22:40:23 +0000
+++ b/NEWS	2008-06-26 00:17:06 +0000
@@ -77,8 +77,16 @@
       parameter.  If you have a subclass of ``Branch`` that overrides
       ``pull`` then you should add this parameter.  (Andrew Bennetts)
 
+    * ``Tree.print_file`` and ``Repository.print_file`` are deprecated.
+      These methods are bad APIs because they write directly to sys.stdout.
+      bzrlib does not use them internally, and there are no direct tests
+      for them. (Alexander Belchenko)
+
   INTERNALS:
 
+    * ``cat`` command no longer uses ``Tree.print_file()`` internally.
+      (Alexander Belchenko)
+
     * New ``versionedfile.KeyMapper`` interface to abstract out the access to
       underlying .knit/.kndx etc files in repositories with partitioned
       storage. (Robert Collins)

=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2008-06-25 10:06:48 +0000
+++ b/bzrlib/builtins.py	2008-06-26 00:13:55 +0000
@@ -2200,14 +2200,15 @@
                 raise errors.BzrCommandError("%r is not present in revision %s"
                                                 % (filename, revision_id))
             else:
-                rev_tree.print_file(old_file_id)
+                content = rev_tree.get_file_text(old_file_id)
         elif cur_file_id is not None:
-            rev_tree.print_file(cur_file_id)
+            content = rev_tree.get_file_text(cur_file_id)
         elif old_file_id is not None:
-            rev_tree.print_file(old_file_id)
+            content = rev_tree.get_file_text(old_file_id)
         else:
             raise errors.BzrCommandError("%r is not present in revision %s" %
                                          (filename, revision_id))
+        self.outf.write(content)
 
 
 class cmd_local_time_offset(Command):

=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py	2008-06-25 10:06:48 +0000
+++ b/bzrlib/repository.py	2008-06-26 00:17:06 +0000
@@ -55,6 +55,10 @@
 from bzrlib.inventory import Inventory, InventoryDirectory, ROOT_ID
 from bzrlib.symbol_versioning import (
         deprecated_method,
+        one_one,
+        one_two,
+        one_three,
+        one_six,
         )
 from bzrlib.trace import mutter, mutter_callsite, note, warning
 
@@ -846,7 +850,7 @@
         return InterRepository.get(other, self).search_missing_revision_ids(
             revision_id, find_ghosts)
 
-    @deprecated_method(symbol_versioning.one_two)
+    @deprecated_method(one_two)
     @needs_read_lock
     def missing_revision_ids(self, other, revision_id=None, find_ghosts=True):
         """Return the revision ids that other has that this does not.
@@ -1664,6 +1668,7 @@
         """
 
     @needs_read_lock
+    @deprecated_method(one_six)
     def print_file(self, file, revision_id):
         """Print `file` to stdout.
         
@@ -1684,7 +1689,7 @@
     def get_transaction(self):
         return self.control_files.get_transaction()
 
-    @deprecated_method(symbol_versioning.one_one)
+    @deprecated_method(one_one)
     def get_parents(self, revision_ids):
         """See StackedParentsProvider.get_parents"""
         parent_map = self.get_parent_map(revision_ids)
@@ -2330,7 +2335,7 @@
             searcher.stop_searching_any(have_revs)
         return searcher.get_result()
    
-    @deprecated_method(symbol_versioning.one_two)
+    @deprecated_method(one_two)
     @needs_read_lock
     def missing_revision_ids(self, revision_id=None, find_ghosts=True):
         """Return the revision ids that source has that target does not.

=== modified file 'bzrlib/tree.py'
--- a/bzrlib/tree.py	2008-06-11 04:20:16 +0000
+++ b/bzrlib/tree.py	2008-06-26 00:17:06 +0000
@@ -434,6 +434,7 @@
         """
         return find_ids_across_trees(paths, [self] + list(trees), require_versioned)
 
+    @symbol_versioning.deprecated_method(symbol_versioning.one_six)
     def print_file(self, file_id):
         """Print file with id `file_id` to stdout."""
         import sys




More information about the bazaar-commits mailing list