Rev 2469: [merge] bzr.dev 2472 in http://bzr.arbash-meinel.com/branches/bzr/0.16-dev/mixed_names_111127

John Arbash Meinel john at arbash-meinel.com
Mon Apr 30 17:26:11 BST 2007


At http://bzr.arbash-meinel.com/branches/bzr/0.16-dev/mixed_names_111127

------------------------------------------------------------
revno: 2469
revision-id: john at arbash-meinel.com-20070430162558-f040stduyrfflef9
parent: john at arbash-meinel.com-20070430162242-3gds64wynnny2t57
parent: pqm at pqm.ubuntu.com-20070430083158-pitv7lbgdu0q8g6h
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: mixed_names_111127
timestamp: Mon 2007-04-30 11:25:58 -0500
message:
  [merge] bzr.dev 2472
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/msgeditor.py            msgeditor.py-20050901111708-ef6d8de98f5d8f2f
  bzrlib/tests/intertree_implementations/test_compare.py test_compare.py-20060724101752-09ysswo1a92uqyoz-2
  bzrlib/tests/test_remote.py    test_remote.py-20060720103555-yeeg2x51vn0rbtdp-2
  bzrlib/tests/test_smart_transport.py test_ssh_transport.py-20060608202016-c25gvf1ob7ypbus6-2
  bzrlib/tests/test_workingtree_4.py test_workingtree_4.p-20070223025758-531n3tznl3zacv2o-1
  bzrlib/transport/remote.py     ssh.py-20060608202016-c25gvf1ob7ypbus6-1
  bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
    ------------------------------------------------------------
    revno: 2466.1.6
    merged: pqm at pqm.ubuntu.com-20070430083158-pitv7lbgdu0q8g6h
    parent: pqm at pqm.ubuntu.com-20070430054416-kl8x12cim7g45lap
    parent: robertc at robertcollins.net-20070430074855-5a5tun52hdc991ue
    committer: Canonical.com Patch Queue Manager<pqm at pqm.ubuntu.com>
    branch nick: +trunk
    timestamp: Mon 2007-04-30 09:31:58 +0100
    message:
      0.16rc2 has been released.
        ------------------------------------------------------------
        revno: 2466.1.5.1.1
        merged: robertc at robertcollins.net-20070430074855-5a5tun52hdc991ue
        parent: pqm at pqm.ubuntu.com-20070430054416-kl8x12cim7g45lap
        committer: Robert Collins <robertc at robertcollins.net>
        branch nick: integration
        timestamp: Mon 2007-04-30 17:48:55 +1000
        message:
          0.16rc2 has been released.
    ------------------------------------------------------------
    revno: 2466.1.5
    merged: pqm at pqm.ubuntu.com-20070430054416-kl8x12cim7g45lap
    parent: pqm at pqm.ubuntu.com-20070430042900-o9x8ggxoevt9s9fi
    parent: robertc at robertcollins.net-20070430051358-8cp7kvp1q0tqhxx0
    committer: Canonical.com Patch Queue Manager<pqm at pqm.ubuntu.com>
    branch nick: +trunk
    timestamp: Mon 2007-04-30 06:44:16 +0100
    message:
      (robertc) ``WorkingTree4._iter_changes`` should not descend into unversioned directories. (John Arbash Meinel, #110399)
        ------------------------------------------------------------
        revno: 2466.5.4
        merged: robertc at robertcollins.net-20070430051358-8cp7kvp1q0tqhxx0
        parent: john at arbash-meinel.com-20070426230146-ip22905t91xhkjs9
        parent: pqm at pqm.ubuntu.com-20070430042900-o9x8ggxoevt9s9fi
        committer: Robert Collins <robertc at robertcollins.net>
        branch nick: integration
        timestamp: Mon 2007-04-30 15:13:58 +1000
        message:
          Merge Johns fix for bug 110399.
        ------------------------------------------------------------
        revno: 2466.5.3
        merged: john at arbash-meinel.com-20070426230146-ip22905t91xhkjs9
        parent: john at arbash-meinel.com-20070426225601-ae4qfcb8bzcfomny
        committer: John Arbash Meinel <john at arbash-meinel.com>
        branch nick: iter_changes_ignores_unknowns
        timestamp: Thu 2007-04-26 18:01:46 -0500
        message:
          Fix bug #110399 by changing _iter_changes to never descend into unknown directories.
          There was a bug when a versioned directory had no versioned children.
          It would descend into all unknown subdirs.
          This was originally fixed when 'want_unchanged=True', but now it is
          also fixed when 'want_unchanged=False'.
          
          We really should have an intertree test for this, but to detect
          descent, we spy on walkdirs, which WT3 doesn't use.
        ------------------------------------------------------------
        revno: 2466.5.2
        merged: john at arbash-meinel.com-20070426225601-ae4qfcb8bzcfomny
        parent: john at arbash-meinel.com-20070426224632-6nrmxl1kfbji3c63
        committer: John Arbash Meinel <john at arbash-meinel.com>
        branch nick: iter_changes_ignores_unknowns
        timestamp: Thu 2007-04-26 17:56:01 -0500
        message:
          Clean up the (failing) test so that the last thing
          to fail is what I'm fixing.
        ------------------------------------------------------------
        revno: 2466.5.1
        merged: john at arbash-meinel.com-20070426224632-6nrmxl1kfbji3c63
        parent: pqm at pqm.ubuntu.com-20070426211103-h84prqh7a4ad3ez2
        committer: John Arbash Meinel <john at arbash-meinel.com>
        branch nick: iter_changes_ignores_unknowns
        timestamp: Thu 2007-04-26 17:46:32 -0500
        message:
          Add a (failing) test that exposes how _iter_changes is accidentally walking into unversioned directories.
    ------------------------------------------------------------
    revno: 2466.1.4
    merged: pqm at pqm.ubuntu.com-20070430042900-o9x8ggxoevt9s9fi
    parent: pqm at pqm.ubuntu.com-20070430040006-olr7xpzdbp02y1sd
    parent: robertc at robertcollins.net-20070430034851-aik2bzpubf44oyjc
    committer: Canonical.com Patch Queue Manager<pqm at pqm.ubuntu.com>
    branch nick: +trunk
    timestamp: Mon 2007-04-30 05:29:00 +0100
    message:
      (robertc) Properly compare filesystem paths with absent and renamed entries. (John Arbash Meinel, #110256)
        ------------------------------------------------------------
        revno: 2465.1.4
        merged: robertc at robertcollins.net-20070430034851-aik2bzpubf44oyjc
        parent: john at arbash-meinel.com-20070426211345-fh5tuoii9mb7w15a
        parent: pqm at pqm.ubuntu.com-20070430025942-y83xydh67a37zebd
        committer: Robert Collins <robertc at robertcollins.net>
        branch nick: integration
        timestamp: Mon 2007-04-30 13:48:51 +1000
        message:
          Merge Johns fix for bug 110256.
        ------------------------------------------------------------
        revno: 2465.1.3
        merged: john at arbash-meinel.com-20070426211345-fh5tuoii9mb7w15a
        parent: john at arbash-meinel.com-20070426211150-q67uvpdf3os770u2
        committer: John Arbash Meinel <john at arbash-meinel.com>
        branch nick: status_after_merge_110256
        timestamp: Thu 2007-04-26 16:13:45 -0500
        message:
          NEWS entry for fixing bug #110256
        ------------------------------------------------------------
        revno: 2465.1.2
        merged: john at arbash-meinel.com-20070426211150-q67uvpdf3os770u2
        parent: john at arbash-meinel.com-20070426204553-sfw4mo98pxggdrfm
        committer: John Arbash Meinel <john at arbash-meinel.com>
        branch nick: status_after_merge_110256
        timestamp: Thu 2007-04-26 16:11:50 -0500
        message:
          Alternate fix for 'absent' entries.
          This also handles 'renamed' entries properly.
          Basically, when we get a path which happens to match a dirstate entry
          check to see if the entry is considered 'live'.
          If it isn't, then we treat it as a non-match, which allows
          later checks to properly handle the file on disk.
        ------------------------------------------------------------
        revno: 2465.1.1
        merged: john at arbash-meinel.com-20070426204553-sfw4mo98pxggdrfm
        parent: pqm at pqm.ubuntu.com-20070426181928-ot99t6eyhjjfj5h3
        committer: John Arbash Meinel <john at arbash-meinel.com>
        branch nick: status_after_merge_110256
        timestamp: Thu 2007-04-26 15:45:53 -0500
        message:
          Add a (failing) test exposing the bug in _iter_changes
          If you bzr mv a => b, and then bzr add a (for a new a), bzr can get
          confused as to the state of 'a'.
    ------------------------------------------------------------
    revno: 2466.1.3
    merged: pqm at pqm.ubuntu.com-20070430040006-olr7xpzdbp02y1sd
    parent: pqm at pqm.ubuntu.com-20070430025942-y83xydh67a37zebd
    parent: andrew.bennetts at canonical.com-20070427021911-pk1ylmrmc1ueo9ad
    committer: Canonical.com Patch Queue Manager<pqm at pqm.ubuntu.com>
    branch nick: +trunk
    timestamp: Mon 2007-04-30 05:00:06 +0100
    message:
      (Andrew Bennetts) Normalise URLs in RemoteHTTPTransport before doing URL calculations to fix bad results.
        ------------------------------------------------------------
        revno: 2466.4.1
        merged: andrew.bennetts at canonical.com-20070427021911-pk1ylmrmc1ueo9ad
        parent: pqm at pqm.ubuntu.com-20070426211103-h84prqh7a4ad3ez2
        committer: Andrew Bennetts <andrew.bennetts at canonical.com>
        branch nick: normalize-remote-http-urls
        timestamp: Fri 2007-04-27 12:19:11 +1000
        message:
          Normalise URLs in RemoteHTTPTransport before doing URL calculations to fix bad results.
    ------------------------------------------------------------
    revno: 2466.1.2
    merged: pqm at pqm.ubuntu.com-20070430025942-y83xydh67a37zebd
    parent: pqm at pqm.ubuntu.com-20070430022343-wnbvslzfz6fpyyj7
    parent: andrew.bennetts at canonical.com-20070430022545-iubud5mcxc1mdsw9
    committer: Canonical.com Patch Queue Manager<pqm at pqm.ubuntu.com>
    branch nick: +trunk
    timestamp: Mon 2007-04-30 03:59:42 +0100
    message:
      (Andrew Bennetts) Fix incompatibility with < 0.16 smart servers.
        ------------------------------------------------------------
        revno: 2466.3.4
        merged: andrew.bennetts at canonical.com-20070430022545-iubud5mcxc1mdsw9
        parent: andrew.bennetts at canonical.com-20070430020406-9vvmb4f9x8bdmvv8
        committer: Andrew Bennetts <andrew.bennetts at canonical.com>
        branch nick: hpss-older-server-compat-bug
        timestamp: Mon 2007-04-30 12:25:45 +1000
        message:
          Tweaks asked for by Robert.
        ------------------------------------------------------------
        revno: 2466.3.3
        merged: andrew.bennetts at canonical.com-20070430020406-9vvmb4f9x8bdmvv8
        parent: andrew.bennetts at canonical.com-20070430020205-ensbvu0t14yb3tk4
        committer: Andrew Bennetts <andrew.bennetts at canonical.com>
        branch nick: hpss-older-server-compat-bug
        timestamp: Mon 2007-04-30 12:04:06 +1000
        message:
          Remove another XXX.
        ------------------------------------------------------------
        revno: 2466.3.2
        merged: andrew.bennetts at canonical.com-20070430020205-ensbvu0t14yb3tk4
        parent: andrew.bennetts at canonical.com-20070427030144-vz2vna1t31ymdgz9
        committer: Andrew Bennetts <andrew.bennetts at canonical.com>
        branch nick: hpss-older-server-compat-bug
        timestamp: Mon 2007-04-30 12:02:05 +1000
        message:
          Add tests for RemoteTransport.is_readonly in the style of the other remote object tests.
        ------------------------------------------------------------
        revno: 2466.3.1
        merged: andrew.bennetts at canonical.com-20070427030144-vz2vna1t31ymdgz9
        parent: pqm at pqm.ubuntu.com-20070426211103-h84prqh7a4ad3ez2
        committer: Andrew Bennetts <andrew.bennetts at canonical.com>
        branch nick: hpss-older-server-compat-bug
        timestamp: Fri 2007-04-27 13:01:44 +1000
        message:
          Fix incompatibility with < 0.16 smart servers.
    ------------------------------------------------------------
    revno: 2466.1.1
    merged: pqm at pqm.ubuntu.com-20070430022343-wnbvslzfz6fpyyj7
    parent: pqm at pqm.ubuntu.com-20070426211103-h84prqh7a4ad3ez2
    parent: robertc at robertcollins.net-20070430014939-mjnji1bq7zulpjlv
    committer: Canonical.com Patch Queue Manager<pqm at pqm.ubuntu.com>
    branch nick: +trunk
    timestamp: Mon 2007-04-30 03:23:43 +0100
    message:
      (robertc) Fix the bzr commit message to be in text mode. (Alexander Belchenko)
    ------------------------------------------------------------
    revno: 2466.2.1
    merged: robertc at robertcollins.net-20070430014939-mjnji1bq7zulpjlv
    parent: pqm at pqm.ubuntu.com-20070426211103-h84prqh7a4ad3ez2
    committer: Robert Collins <robertc at robertcollins.net>
    branch nick: integration
    timestamp: Mon 2007-04-30 11:49:39 +1000
    message:
      Fix the bzr commit message to be in text mode. (Alexander Belchenko)
-------------- next part --------------
=== modified file 'NEWS'
--- a/NEWS	2007-04-26 18:53:33 +0000
+++ b/NEWS	2007-04-30 07:48:55 +0000
@@ -1,5 +1,7 @@
 IN DEVELOPMENT
 
+bzr 0.16rc2  2007-04-30
+
   BUGFIXES:
 
     * Handle the case when you delete a file, and then rename another file
@@ -11,6 +13,14 @@
       empty value. And when the value is not ASCII.
       (John Arbash Meinel, #109613)
 
+    * Fix the bzr commit message to be in text mode.
+      (Alexander Belchenko, #110901)
+
+    * Also handle when you rename a file and create a file where it used
+      to be. (John Arbash Meinel, #110256)
+
+    * ``WorkingTree4._iter_changes`` should not descend into unversioned
+      directories. (John Arbash Meinel, #110399)
 
 bzr 0.16rc1  2007-04-26
 

=== modified file 'bzrlib/msgeditor.py'
--- a/bzrlib/msgeditor.py	2007-02-26 21:48:05 +0000
+++ b/bzrlib/msgeditor.py	2007-04-30 01:49:39 +0000
@@ -103,7 +103,9 @@
 
     msgfilename = None
     try:
-        tmp_fileno, msgfilename = tempfile.mkstemp(prefix='bzr_log.', dir=u'.')
+        tmp_fileno, msgfilename = tempfile.mkstemp(prefix='bzr_log.',
+                                                   dir=u'.',
+                                                   text=True)
         msgfile = os.fdopen(tmp_fileno, 'w')
         try:
             if start_message is not None:

=== modified file 'bzrlib/tests/intertree_implementations/test_compare.py'
--- a/bzrlib/tests/intertree_implementations/test_compare.py	2007-04-30 16:22:42 +0000
+++ b/bzrlib/tests/intertree_implementations/test_compare.py	2007-04-30 16:25:58 +0000
@@ -1357,3 +1357,39 @@
         self.assertEqual(expected,
                          self.do_iter_changes(tree1, tree2,
                                               want_unversioned=False))
+
+    def test_renamed_and_added(self):
+        """Test when we have renamed a file, and put another in its place."""
+        tree1 = self.make_branch_and_tree('tree1')
+        tree2 = self.make_to_branch_and_tree('tree2')
+        root_id = tree1.get_root_id()
+        tree2.set_root_id(root_id)
+
+        # The final changes are:
+        # bzr add b c
+        # bzr mv b a
+        # bzr mv c d
+        # bzr add b c
+
+        self.build_tree_contents([
+            ('tree1/b', 'b contents\n'),
+            ('tree1/c', 'c contents\n'),
+            ('tree2/a', 'b contents\n'),
+            ('tree2/b', 'new b contents\n'),
+            ('tree2/c', 'new c contents\n'),
+            ('tree2/d', 'c contents\n'),
+            ])
+        tree1.add(['b', 'c'], ['b1-id', 'c1-id'])
+        tree2.add(['a', 'b', 'c', 'd'], ['b1-id', 'b2-id', 'c2-id', 'c1-id'])
+
+        tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
+
+        expected = sorted([
+            self.renamed(tree1, tree2, 'b1-id', False),
+            self.renamed(tree1, tree2, 'c1-id', False),
+            self.added(tree2, 'b2-id'),
+            self.added(tree2, 'c2-id'),
+            ])
+        self.assertEqual(expected,
+                         self.do_iter_changes(tree1, tree2,
+                                              want_unversioned=True))

=== modified file 'bzrlib/tests/test_remote.py'
--- a/bzrlib/tests/test_remote.py	2007-04-26 08:15:40 +0000
+++ b/bzrlib/tests/test_remote.py	2007-04-30 02:04:06 +0000
@@ -44,6 +44,7 @@
 from bzrlib.smart import server, medium
 from bzrlib.smart.client import _SmartClient
 from bzrlib.transport.memory import MemoryTransport
+from bzrlib.transport.remote import RemoteTransport
 
 
 class BasicRemoteObjectTests(tests.TestCaseWithTransport):
@@ -60,12 +61,6 @@
         self.transport.disconnect()
         tests.TestCaseWithTransport.tearDown(self)
 
-    def test_is_readonly(self):
-        # XXX: this is a poor way to test RemoteTransport, but currently there's
-        # no easy way to substitute in a fake client on a transport like we can
-        # with RemoteBzrDir/Branch/Repository.
-        self.assertEqual(self.transport.is_readonly(), False)
-
     def test_create_remote_bzrdir(self):
         b = remote.RemoteBzrDir(self.transport)
         self.assertIsInstance(b, BzrDir)
@@ -104,20 +99,6 @@
         self.assertIsInstance(d, BzrDir)
 
 
-class ReadonlyRemoteTransportTests(tests.TestCaseWithTransport):
-
-    def setUp(self):
-        self.transport_server = server.ReadonlySmartTCPServer_for_testing
-        super(ReadonlyRemoteTransportTests, self).setUp()
-
-    def test_is_readonly_yes(self):
-        # XXX: this is a poor way to test RemoteTransport, but currently there's
-        # no easy way to substitute in a fake client on a transport like we can
-        # with RemoteBzrDir/Branch/Repository.
-        transport = self.get_readonly_transport()
-        self.assertEqual(transport.is_readonly(), True)
-
-
 class FakeProtocol(object):
     """Lookalike SmartClientRequestProtocolOne allowing body reading tests."""
 
@@ -404,6 +385,44 @@
             client._calls)
 
 
+class TestTransportIsReadonly(tests.TestCase):
+
+    def test_true(self):
+        client = FakeClient([(('yes',), '')])
+        transport = RemoteTransport('bzr://example.com/', medium=False,
+                                    _client=client)
+        self.assertEqual(True, transport.is_readonly())
+        self.assertEqual(
+            [('call', 'Transport.is_readonly', ())],
+            client._calls)
+
+    def test_false(self):
+        client = FakeClient([(('no',), '')])
+        transport = RemoteTransport('bzr://example.com/', medium=False,
+                                    _client=client)
+        self.assertEqual(False, transport.is_readonly())
+        self.assertEqual(
+            [('call', 'Transport.is_readonly', ())],
+            client._calls)
+
+    def test_error_from_old_server(self):
+        """bzr 0.15 and earlier servers don't recognise the is_readonly verb.
+        
+        Clients should treat it as a "no" response, because is_readonly is only
+        advisory anyway (a transport could be read-write, but then the
+        underlying filesystem could be readonly anyway).
+        """
+        client = FakeClient([(
+            ('error', "Generic bzr smart protocol error: "
+                      "bad request 'Transport.is_readonly'"), '')])
+        transport = RemoteTransport('bzr://example.com/', medium=False,
+                                    _client=client)
+        self.assertEqual(False, transport.is_readonly())
+        self.assertEqual(
+            [('call', 'Transport.is_readonly', ())],
+            client._calls)
+
+
 class TestRemoteRepository(tests.TestCase):
     """Base for testing RemoteRepository protocol usage.
     

=== modified file 'bzrlib/tests/test_smart_transport.py'
--- a/bzrlib/tests/test_smart_transport.py	2007-04-26 09:07:38 +0000
+++ b/bzrlib/tests/test_smart_transport.py	2007-04-27 02:19:11 +0000
@@ -2087,6 +2087,19 @@
         new_transport = base_transport.clone('abc/../..')
         self.assertEqual('foo', new_transport._remote_path('foo'))
 
+    def test_remote_path_unnormal_base(self):
+        # If the transport's base isn't normalised, the _remote_path should
+        # still be calculated correctly.
+        base_transport = remote.RemoteHTTPTransport('bzr+http://host/%7Ea/b')
+        self.assertEqual('c', base_transport._remote_path('c'))
+
+    def test_clone_unnormal_base(self):
+        # If the transport's base isn't normalised, cloned transports should
+        # still work correctly.
+        base_transport = remote.RemoteHTTPTransport('bzr+http://host/%7Ea/b')
+        new_transport = base_transport.clone('c')
+        self.assertEqual('bzr+http://host/%7Ea/b/c/', new_transport.base)
+
         
 # TODO: Client feature that does get_bundle and then installs that into a
 # branch; this can be used in place of the regular pull/fetch operation when

=== modified file 'bzrlib/tests/test_workingtree_4.py'
--- a/bzrlib/tests/test_workingtree_4.py	2007-04-20 04:19:55 +0000
+++ b/bzrlib/tests/test_workingtree_4.py	2007-04-26 22:56:01 +0000
@@ -24,6 +24,7 @@
     dirstate,
     errors,
     inventory,
+    osutils,
     workingtree_4,
     )
 from bzrlib.lockdir import LockDir
@@ -523,3 +524,53 @@
         # having checked this is on, the tree interface, and intertree
         # interface tests, will proceed to test the subtree support of
         # workingtree_4.
+
+    def test_iter_changes_ignores_unversioned_dirs(self):
+        """_iter_changes should not descend into unversioned directories."""
+        tree = self.make_branch_and_tree('.', format='dirstate')
+        # We have an unversioned directory at the root, a versioned one with
+        # other versioned files and an unversioned directory, and another
+        # versioned dir with nothing but an unversioned directory.
+        self.build_tree(['unversioned/',
+                         'unversioned/a',
+                         'unversioned/b/',
+                         'versioned/',
+                         'versioned/unversioned/',
+                         'versioned/unversioned/a',
+                         'versioned/unversioned/b/',
+                         'versioned2/',
+                         'versioned2/a',
+                         'versioned2/unversioned/',
+                         'versioned2/unversioned/a',
+                         'versioned2/unversioned/b/',
+                        ])
+        tree.add(['versioned', 'versioned2', 'versioned2/a'])
+        tree.commit('one', rev_id='rev-1')
+        # Trap osutils._walkdirs_utf8 to spy on what dirs have been accessed.
+        returned = []
+        orig_walkdirs = osutils._walkdirs_utf8
+        def reset():
+            osutils._walkdirs_utf8 = orig_walkdirs
+        self.addCleanup(reset)
+        def walkdirs_spy(*args, **kwargs):
+            for val in orig_walkdirs(*args, **kwargs):
+                returned.append(val[0][0])
+                yield val
+        osutils._walkdirs_utf8 = walkdirs_spy
+
+        basis = tree.basis_tree()
+        tree.lock_read()
+        self.addCleanup(tree.unlock)
+        basis.lock_read()
+        self.addCleanup(basis.unlock)
+        changes = [c[1] for c in
+                   tree._iter_changes(basis, want_unversioned=True)]
+        self.assertEqual([(None, 'unversioned'),
+                          (None, 'versioned/unversioned'),
+                          (None, 'versioned2/unversioned'),
+                         ], changes)
+        self.assertEqual(['', 'versioned', 'versioned2'], returned)
+        del returned[:] # reset
+        changes = [c[1] for c in tree._iter_changes(basis)]
+        self.assertEqual([], changes)
+        self.assertEqual(['', 'versioned', 'versioned2'], returned)

=== modified file 'bzrlib/transport/remote.py'
--- a/bzrlib/transport/remote.py	2007-04-26 06:19:07 +0000
+++ b/bzrlib/transport/remote.py	2007-04-30 04:00:06 +0000
@@ -74,11 +74,17 @@
     # RemoteTransport is an adapter from the Transport object model to the 
     # SmartClient model, not an encoder.
 
-    def __init__(self, url, clone_from=None, medium=None):
+    def __init__(self, url, clone_from=None, medium=None, _client=None):
         """Constructor.
 
+        :param clone_from: Another RemoteTransport instance that this one is
+            being cloned from.  Attributes such as credentials and the medium
+            will be reused.
         :param medium: The medium to use for this RemoteTransport. This must be
             supplied if clone_from is None.
+        :param _client: Override the _SmartClient used by this transport.  This
+            should only be used for testing purposes; normally this is
+            determined from the medium.
         """
         ### Technically super() here is faulty because Transport's __init__
         ### fails to take 2 parameters, and if super were to choose a silly
@@ -97,6 +103,10 @@
             # reuse same connection
             self._medium = clone_from._medium
         assert self._medium is not None
+        if _client is None:
+            self._client = client._SmartClient(self._medium)
+        else:
+            self._client = _client
 
     def abspath(self, relpath):
         """Return the full url to the given relative path.
@@ -123,6 +133,12 @@
             return True
         elif resp == ('no', ):
             return False
+        elif resp == ('error', "Generic bzr smart protocol error: "
+                               "bad request 'Transport.is_readonly'"):
+            # XXX: nasty hack: servers before 0.16 don't have a
+            # 'Transport.is_readonly' verb, so we do what clients before 0.16
+            # did: assume False.
+            return False
         else:
             self._translate_error(resp)
         assert False, 'weird response %r' % (resp,)
@@ -160,12 +176,11 @@
 
     def _call2(self, method, *args):
         """Call a method on the remote server."""
-        return client._SmartClient(self._medium).call(method, *args)
+        return self._client.call(method, *args)
 
     def _call_with_body_bytes(self, method, args, body):
         """Call a method on the remote server with body bytes."""
-        smart_client = client._SmartClient(self._medium)
-        return smart_client.call_with_body_bytes(method, args, body)
+        return self._client.call_with_body_bytes(method, args, body)
 
     def has(self, relpath):
         """Indicate whether a remote file of the given name exists or not.
@@ -488,7 +503,7 @@
         """After connecting HTTP Transport only deals in relative URLs."""
         # Adjust the relpath based on which URL this smart transport is
         # connected to.
-        base = self._http_transport.base
+        base = urlutils.normalize_url(self._http_transport.base)
         url = urlutils.join(self.base[len('bzr+'):], relpath)
         url = urlutils.normalize_url(url)
         return urlutils.relative_url(base, url)
@@ -523,7 +538,9 @@
         # We either use the exact same http_transport (for child locations), or
         # a clone of the underlying http_transport (for parent locations).  This
         # means we share the connection.
-        normalized_rel_url = urlutils.relative_url(self.base, abs_url)
+        norm_base = urlutils.normalize_url(self.base)
+        norm_abs_url = urlutils.normalize_url(abs_url)
+        normalized_rel_url = urlutils.relative_url(norm_base, norm_abs_url)
         if normalized_rel_url == ".." or normalized_rel_url.startswith("../"):
             http_transport = self._http_transport.clone(normalized_rel_url)
         else:

=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py	2007-04-25 22:07:09 +0000
+++ b/bzrlib/workingtree_4.py	2007-04-30 05:13:58 +0000
@@ -2132,10 +2132,10 @@
                         # new unknown files or directories.
                         # if (B) then we should ignore it, because we don't
                         # recurse into unknown directories.
-                        if want_unversioned:
-                            path_index = 0
-                            while path_index < len(current_dir_info[1]):
-                                    current_path_info = current_dir_info[1][path_index]
+                        path_index = 0
+                        while path_index < len(current_dir_info[1]):
+                                current_path_info = current_dir_info[1][path_index]
+                                if want_unversioned:
                                     if current_path_info[2] == 'directory':
                                         if self.target._directory_is_tree_reference(
                                             current_path_info[0].decode('utf8')):
@@ -2152,13 +2152,13 @@
                                         (None, utf8_decode_or_none(current_path_info[1])),
                                         (None, current_path_info[2]),
                                         (None, new_executable))
-                                    # dont descend into this unversioned path if it is
-                                    # a dir
-                                    if current_path_info[2] in ('directory',
-                                                                'tree-reference'):
-                                        del current_dir_info[1][path_index]
-                                        path_index -= 1
-                                    path_index += 1
+                                # dont descend into this unversioned path if it is
+                                # a dir
+                                if current_path_info[2] in ('directory',
+                                                            'tree-reference'):
+                                    del current_dir_info[1][path_index]
+                                    path_index -= 1
+                                path_index += 1
 
                         # This dir info has been handled, go to the next
                         try:
@@ -2289,16 +2289,39 @@
                                            result[7],
                                           )
                             advance_path = False
+                    elif current_entry[1][target_index][0] in 'ar':
+                        # The path matches, but the current entry is marked as
+                        # not being here. So we don't want to consider this
+                        # as a match. We still need to process the current
+                        # entry, though.
+                        advance_path = False
+                        path_handled = False
+                        for result in _process_entry(current_entry, None):
+                            if (include_unchanged
+                                or result[2]                    # content change
+                                or result[3][0] != result[3][1] # versioned status
+                                or result[4][0] != result[4][1] # parent id
+                                or result[5][0] != result[5][1] # name
+                                or result[6][0] != result[6][1] # kind
+                                or result[7][0] != result[7][1] # executable
+                                ):
+                                yield (result[0],
+                                       (utf8_decode_or_none(result[1][0]),
+                                        utf8_decode_or_none(result[1][1])),
+                                       result[2],
+                                       result[3],
+                                       result[4],
+                                       (utf8_decode_or_none(result[5][0]),
+                                        utf8_decode_or_none(result[5][1])),
+                                       result[6],
+                                       result[7],
+                                      )
                     else:
                         for result in _process_entry(current_entry, current_path_info):
                             # this check should probably be outside the loop: one
                             # 'iterate two trees' api, and then _iter_changes filters
                             # unchanged pairs. - RBC 20070226
-                            if current_entry[1][target_index][0] == 'a':
-                                advance_path = False
-                                path_handled = False
-                            else:
-                                path_handled = True
+                            path_handled = True
                             if (include_unchanged
                                 or result[2]                    # content change
                                 or result[3][0] != result[3][1] # versioned status



More information about the bazaar-commits mailing list