[MERGE] Allow remote cat to operate again (#73500)

Wouter van Heyst larstiq at larstiq.dyndns.org
Thu Nov 30 23:57:20 GMT 2006


I'm not overly fond of the current cmd_cat code, but at least it fixes
the bug in question.

Wouter van Heyst
-------------- next part --------------
# Bazaar revision bundle v0.8
#
# message:
#   Fix #73500 mostly by catching a NotLocalUrl exception in cmd_cat.
# committer: Wouter van Heyst <larstiq at larstiq.dyndns.org>
# date: Thu 2006-11-30 23:58:22.523000002 +0100

=== modified file bzrlib/builtins.py
--- bzrlib/builtins.py
+++ bzrlib/builtins.py
@@ -1745,13 +1745,14 @@
         try:
             tree, relpath = WorkingTree.open_containing(filename)
             b = tree.branch
-        except errors.NotBranchError:
+        except (errors.NotBranchError, errors.NotLocalUrl):
             pass
 
+        if revision is not None and revision[0].get_branch() is not None:
+            b = Branch.open(revision[0].get_branch())
         if tree is None:
             b, relpath = Branch.open_containing(filename)
-        if revision is not None and revision[0].get_branch() is not None:
-            b = Branch.open(revision[0].get_branch())
+            tree = b.basis_tree()
         if revision is None:
             revision_id = b.last_revision()
         else:

=== modified file bzrlib/tests/blackbox/test_cat.py
--- bzrlib/tests/blackbox/test_cat.py
+++ bzrlib/tests/blackbox/test_cat.py
@@ -21,9 +21,9 @@
 
 import os
 
-from bzrlib.tests.blackbox import ExternalBase
+from bzrlib.tests.blackbox import TestCaseWithTransport
 
-class TestCat(ExternalBase):
+class TestCat(TestCaseWithTransport):
 
     def test_cat(self):
 
@@ -96,3 +96,11 @@
         finally:
             tree.unlock()
 
+    def test_remote_cat(self):
+        wt = self.make_branch_and_tree('.')
+        self.build_tree(['README', 'See INSTALL'])
+        wt.add('README')
+        wt.commit('Making sure there is a basis_tree available')
+
+        url = self.get_readonly_url() + '/README'
+        self.run_bzr('cat', url)

=== modified directory  // last-changed:larstiq at larstiq.dyndns.org-200611302258
... 22-tagecep0mbdu9rmh
# revision id: larstiq at larstiq.dyndns.org-20061130225822-tagecep0mbdu9rmh
# sha1: 3d8bf03d2d9fff1c8bf67bbe78b34917dc580ee3
# inventory sha1: 78fb5623a93464f73428f1113d69a6e80e8d336b
# parent ids:
#   pqm at pqm.ubuntu.com-20061130181753-8f59214477f99124
# base id: pqm at pqm.ubuntu.com-20061130181753-8f59214477f99124
# properties:
#   branch-nick: remote-cat-73500

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 307 bytes
Desc: Digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20061201/007f8daf/attachment.pgp 


More information about the bazaar mailing list