Rev 4790: Fix a code path that was trying to open a URL as though it was a local path. in http://bazaar.launchpad.net/~jameinel/bzr/2.1.0b4-win32-sprout-bzrdir

John Arbash Meinel john at arbash-meinel.com
Sun Nov 8 03:25:39 GMT 2009


At http://bazaar.launchpad.net/~jameinel/bzr/2.1.0b4-win32-sprout-bzrdir

------------------------------------------------------------
revno: 4790
revision-id: john at arbash-meinel.com-20091108032529-lxhhn2zr29dln7u1
parent: pqm at pqm.ubuntu.com-20091106084512-t5ll6xywcd1bycfe
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.1.0b4-win32-sprout-bzrdir
timestamp: Sat 2009-11-07 21:25:29 -0600
message:
  Fix a code path that was trying to open a URL as though it was a local path.
  
  It turned out that this never failed on Linux because we were trapping for ENOENT.
  However, on Windows we get a different error because 'file://' is an invalid
  filename. Fixing that ended up finding some other small issues because of
  things like expecting 'TREE_ROOT' to be in the inventory xml, but it wasn't.
  
  I'm not 100% sure about that fix, but since this code *wasn't* tested at all, it
  doesn't seem terribly important.
-------------- next part --------------
=== modified file 'bzrlib/tests/per_bzrdir/test_bzrdir.py'
--- a/bzrlib/tests/per_bzrdir/test_bzrdir.py	2009-09-18 17:19:15 +0000
+++ b/bzrlib/tests/per_bzrdir/test_bzrdir.py	2009-11-08 03:25:29 +0000
@@ -778,13 +778,18 @@
                                      './.bzr/repository/inventory.knit',
                                      ])
         try:
+            local_inventory = dir.transport.local_abspath('inventory')
+        except errors.NotLocalUrl:
+            return
+        try:
             # If we happen to have a tree, we'll guarantee everything
             # except for the tree root is the same.
-            inventory_f = file(dir.transport.base+'inventory', 'rb')
-            self.assertContainsRe(inventory_f.read(),
-                                  '<inventory file_id="TREE_ROOT[^"]*"'
-                                  ' format="5">\n</inventory>\n')
-            inventory_f.close()
+            inventory_f = file(local_inventory, 'rb')
+            try:
+                self.assertContainsRe(inventory_f.read(),
+                                      '<inventory format="5">\n</inventory>\n')
+            finally:
+                inventory_f.close()
         except IOError, e:
             if e.errno != errno.ENOENT:
                 raise



More information about the bazaar-commits mailing list