Rev 2422: (bialix, r=john) win32-related selftest improvements in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Mon Apr 16 22:05:49 BST 2007


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

------------------------------------------------------------
revno: 2422
revision-id: pqm at pqm.ubuntu.com-20070416210546-4ib7pt7wkkk71zzj
parent: pqm at pqm.ubuntu.com-20070416180853-ucztrxo25i0fci62
parent: bialix at ukr.net-20070416204259-tyi3ptqe80gpkwcl
committer: Canonical.com Patch Queue Manager<pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Mon 2007-04-16 22:05:46 +0100
message:
  (bialix,r=john) win32-related selftest improvements
modified:
  bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
  bzrlib/tests/blackbox/test_status.py teststatus.py-20050712014354-508855eb9f29f7dc
  bzrlib/tests/intertree_implementations/test_compare.py test_compare.py-20060724101752-09ysswo1a92uqyoz-2
  bzrlib/tests/tree_implementations/__init__.py __init__.py-20060717075546-420s7b0bj9hzeowi-2
  bzrlib/tests/tree_implementations/test_inv.py test_inv.py-20070312023226-0cdvk5uwhutis9vg-1
  bzrlib/tests/tree_implementations/test_test_trees.py test_tree_trees.py-20060720091921-3nwi5h21lf06vf5p-1
  bzrlib/tests/tree_implementations/test_walkdirs.py test_walkdirs.py-20060729160421-gmjnkotqgxdh98ce-1
  bzrlib/tests/workingtree_implementations/test_walkdirs.py test_walkdirs.py-20060731045042-ch366w6dve2m7ro9-1
  bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
    ------------------------------------------------------------
    revno: 2408.1.8
    merged: bialix at ukr.net-20070416204259-tyi3ptqe80gpkwcl
    parent: bialix at ukr.net-20070414182636-cu2loiemveb20ljh
    committer: Alexander Belchenko <bialix at ukr.net>
    branch nick: selftest.win32
    timestamp: Mon 2007-04-16 23:42:59 +0300
    message:
      forget to return tree
    ------------------------------------------------------------
    revno: 2408.1.7
    merged: bialix at ukr.net-20070414182636-cu2loiemveb20ljh
    parent: bialix at ukr.net-20070414121935-s673tupvwywawpwv
    committer: Alexander Belchenko <bialix at ukr.net>
    branch nick: selftest.win32
    timestamp: Sat 2007-04-14 21:26:36 +0300
    message:
      Fix blackbox test_status_out_of_date: unlock WT before next command running
    ------------------------------------------------------------
    revno: 2408.1.6
    merged: bialix at ukr.net-20070414121935-s673tupvwywawpwv
    parent: bialix at ukr.net-20070414121842-otxkoravow2qrmyx
    parent: pqm at pqm.ubuntu.com-20070413174100-zpfqleaf5ph9ycx4
    committer: Alexander Belchenko <bialix at ukr.net>
    branch nick: selftest.win32
    timestamp: Sat 2007-04-14 15:19:35 +0300
    message:
      merge bzr.dev
    ------------------------------------------------------------
    revno: 2408.1.5
    merged: bialix at ukr.net-20070414121842-otxkoravow2qrmyx
    parent: bialix at ukr.net-20070414121731-jtc76rfulndihkh3
    committer: Alexander Belchenko <bialix at ukr.net>
    branch nick: selftest.win32
    timestamp: Sat 2007-04-14 15:18:42 +0300
    message:
      John's patch for WT4 on Windows+Python2.4
    ------------------------------------------------------------
    revno: 2408.1.4
    merged: bialix at ukr.net-20070414121731-jtc76rfulndihkh3
    parent: bialix at ukr.net-20070414115551-zb314hff40n9fe0a
    committer: Alexander Belchenko <bialix at ukr.net>
    branch nick: selftest.win32
    timestamp: Sat 2007-04-14 15:17:31 +0300
    message:
      workingtree_implementations: make usage of symlinks optional
    ------------------------------------------------------------
    revno: 2408.1.3
    merged: bialix at ukr.net-20070414115551-zb314hff40n9fe0a
    parent: bialix at ukr.net-20070413070332-dtazdq7opt2v16sc
    committer: Alexander Belchenko <bialix at ukr.net>
    branch nick: selftest.win32
    timestamp: Sat 2007-04-14 14:55:51 +0300
    message:
      tree_implementations: make usage of symlinks optional
    ------------------------------------------------------------
    revno: 2408.1.2
    merged: bialix at ukr.net-20070413070332-dtazdq7opt2v16sc
    parent: bialix at ukr.net-20070413070210-mlt8fx1awnlytx3n
    committer: Alexander Belchenko <bialix at ukr.net>
    branch nick: selftest.win32
    timestamp: Fri 2007-04-13 10:03:32 +0300
    message:
      intertree_implementations: make usage of symlinks optional
    ------------------------------------------------------------
    revno: 2408.1.1
    merged: bialix at ukr.net-20070413070210-mlt8fx1awnlytx3n
    parent: pqm at pqm.ubuntu.com-20070412032019-axeg1wmcju0odfdr
    committer: Alexander Belchenko <bialix at ukr.net>
    branch nick: selftest.win32
    timestamp: Fri 2007-04-13 10:02:10 +0300
    message:
      fix error handler in _rmtree_temp_dir()
=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2007-04-12 00:59:53 +0000
+++ b/bzrlib/tests/__init__.py	2007-04-13 07:02:10 +0000
@@ -2293,7 +2293,7 @@
         if sys.platform == 'win32' and e.errno == errno.EACCES:
             print >>sys.stderr, ('Permission denied: '
                                  'unable to remove testing dir '
-                                 '%s' % os.path.basename(test_root))
+                                 '%s' % os.path.basename(dirname))
         else:
             raise
 

=== modified file 'bzrlib/tests/blackbox/test_status.py'
--- a/bzrlib/tests/blackbox/test_status.py	2007-03-07 14:49:00 +0000
+++ b/bzrlib/tests/blackbox/test_status.py	2007-04-14 18:26:36 +0000
@@ -244,11 +244,12 @@
             tree.commit('add test file')
             # simulate what happens after a remote push
             tree.set_last_revision("0")
-            out, err = self.run_bzr('status')
-            self.assertEqual("working tree is out of date, run 'bzr update'\n",
-                             err)
         finally:
+            # before run another commands we should unlock tree
             tree.unlock()
+        out, err = self.run_bzr('status')
+        self.assertEqual("working tree is out of date, run 'bzr update'\n",
+                         err)
 
 
 class CheckoutStatus(BranchStatus):

=== modified file 'bzrlib/tests/intertree_implementations/test_compare.py'
--- a/bzrlib/tests/intertree_implementations/test_compare.py	2007-03-21 04:14:35 +0000
+++ b/bzrlib/tests/intertree_implementations/test_compare.py	2007-04-13 07:03:32 +0000
@@ -321,11 +321,11 @@
         tree2 = self.make_to_branch_and_tree('tree2')
         tree2.set_root_id(tree1.get_root_id())
         self.build_tree(['tree2/file', 'tree2/dir/'])
-        # try:
-        os.symlink('target', 'tree2/link')
-        links_supported = True
-        # except ???:
-        #   links_supported = False
+        if has_symlinks():
+            os.symlink('target', 'tree2/link')
+            links_supported = True
+        else:
+            links_supported = False
         tree1, tree2 = self.mutable_trees_to_test_trees(tree1, tree2)
         d = self.intertree_class(tree1, tree2).compare(want_unversioned=True)
         self.assertEqual([], d.added)
@@ -333,8 +333,11 @@
         self.assertEqual([], d.removed)
         self.assertEqual([], d.renamed)
         self.assertEqual([], d.unchanged)
-        self.assertEqual([(u'dir', None, 'directory'), (u'file', None, 'file'),
-            (u'link', None, 'symlink')], d.unversioned)
+        expected_unversioned = [(u'dir', None, 'directory'),
+                                (u'file', None, 'file')]
+        if links_supported:
+            expected_unversioned.append((u'link', None, 'symlink'))
+        self.assertEqual(expected_unversioned, d.unversioned)
 
 
 class TestIterChanges(TestCaseWithTwoTrees):
@@ -776,11 +779,11 @@
         tree2 = self.make_to_branch_and_tree('tree2')
         tree2.set_root_id(tree1.get_root_id())
         self.build_tree(['tree2/file', 'tree2/dir/'])
-        # try:
-        os.symlink('target', 'tree2/link')
-        links_supported = True
-        # except ???:
-        #   links_supported = False
+        if has_symlinks():
+            os.symlink('target', 'tree2/link')
+            links_supported = True
+        else:
+            links_supported = False
         tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
         expected = [
             self.unversioned(tree2, 'file'),
@@ -796,11 +799,11 @@
         tree1 = self.make_branch_and_tree('tree1')
         tree2 = self.make_to_branch_and_tree('tree2')
         self.build_tree(['tree2/file', 'tree2/dir/'])
-        # try:
-        os.symlink('target', 'tree2/link')
-        links_supported = True
-        # except ???:
-        #   links_supported = False
+        if has_symlinks():
+            os.symlink('target', 'tree2/link')
+            links_supported = True
+        else:
+            links_supported = False
         tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
         expected = [
             self.unversioned(tree2, 'file'),
@@ -829,16 +832,18 @@
         self.build_tree(['tree2/file', 'tree2/dir/',
             'tree1/file', 'tree2/movedfile',
             'tree1/dir/', 'tree2/moveddir/'])
-        # try:
-        os.symlink('target', 'tree1/link')
-        os.symlink('target', 'tree2/link')
-        os.symlink('target', 'tree2/movedlink')
-        links_supported = True
-        # except ???:
-        #   links_supported = False
-        tree1.add(['file', 'dir', 'link'], ['file-id', 'dir-id', 'link-id'])
-        tree2.add(['movedfile', 'moveddir', 'movedlink'],
-            ['file-id', 'dir-id', 'link-id'])
+        if has_symlinks():
+            os.symlink('target', 'tree1/link')
+            os.symlink('target', 'tree2/link')
+            os.symlink('target', 'tree2/movedlink')
+            links_supported = True
+        else:
+            links_supported = False
+        tree1.add(['file', 'dir'], ['file-id', 'dir-id'])
+        tree2.add(['movedfile', 'moveddir'], ['file-id', 'dir-id'])
+        if links_supported:
+            tree1.add(['link'], ['link-id'])
+            tree2.add(['movedlink'], ['link-id'])
         tree1, tree2 = self.mutable_trees_to_locked_test_trees(tree1, tree2)
         root_id = tree1.path2id('')
         expected = [

=== modified file 'bzrlib/tests/tree_implementations/__init__.py'
--- a/bzrlib/tests/tree_implementations/__init__.py	2007-03-12 02:35:23 +0000
+++ b/bzrlib/tests/tree_implementations/__init__.py	2007-04-16 20:42:59 +0000
@@ -180,16 +180,31 @@
 
     def get_tree_with_subdirs_and_all_content_types(self):
         """Return a test tree with subdirs and all content types.
+        See get_tree_with_subdirs_and_all_supported_content_types for details.
+        """
+        return self.get_tree_with_subdirs_and_all_supported_content_types(True)
+
+    def get_tree_with_subdirs_and_all_supported_content_types(self, symlinks):
+        """Return a test tree with subdirs and all supported content types.
+        Some content types may not be created on some platforms
+        (like symlinks on native win32)
+
+        :param  symlinks:   control is symlink should be created in the tree.
+                            Note: if you wish to automatically set this
+                            parameters depending on underlying system,
+                            please use value returned
+                            by bzrlib.osutils.has_symlinks() function.
 
         The returned tree has the following inventory:
             [('', inventory.ROOT_ID),
              ('0file', '2file'),
              ('1top-dir', '1top-dir'),
              (u'2utf\u1234file', u'0utf\u1234file'),
-             ('symlink', 'symlink'),
+             ('symlink', 'symlink'),            # only if symlinks arg is True
              ('1top-dir/0file-in-1topdir', '1file-in-1topdir'),
              ('1top-dir/1dir-in-1topdir', '0dir-in-1topdir')]
-        where each component has the type of its name - i.e. '1file..' is afile.
+        where each component has the type of its name -
+        i.e. '1file..' is afile.
 
         note that the order of the paths and fileids is deliberately 
         mismatched to ensure that the result order is path based.
@@ -215,9 +230,10 @@
                 'This platform does not support unicode file paths.')
         tree.add(paths, ids)
         tt = transform.TreeTransform(tree)
-        root_transaction_id = tt.trans_id_tree_path('')
-        tt.new_symlink('symlink',
-            root_transaction_id, 'link-target', 'symlink')
+        if symlinks:
+            root_transaction_id = tt.trans_id_tree_path('')
+            tt.new_symlink('symlink',
+                root_transaction_id, 'link-target', 'symlink')
         tt.apply()
         return self.workingtree_to_test_tree(tree)
 

=== modified file 'bzrlib/tests/tree_implementations/test_inv.py'
--- a/bzrlib/tests/tree_implementations/test_inv.py	2007-03-12 03:31:12 +0000
+++ b/bzrlib/tests/tree_implementations/test_inv.py	2007-04-14 11:55:51 +0000
@@ -212,8 +212,7 @@
 
 class TestInventory(TestCaseWithTree):
 
-    def setUp(self):
-        super(TestInventory, self).setUp()
+    def _set_up(self):
         self.tree = self.get_tree_with_subdirs_and_all_content_types()
         self.tree.lock_read()
         self.addCleanup(self.tree.unlock)
@@ -221,6 +220,9 @@
         self.inv = self.tree.inventory
 
     def test_symlink_target(self):
+        if not has_symlinks():
+            raise TestSkipped('No symlink support')
+        self._set_up()
         if isinstance(self.tree, MutableTree):
             raise TestSkipped(
                 'symlinks not accurately represented in working trees')
@@ -228,6 +230,9 @@
         self.assertEqual(entry.symlink_target, 'link-target')
 
     def test_symlink(self):
+        if not has_symlinks():
+            raise TestSkipped('No symlink support')
+        self._set_up()
         entry = self.inv[self.inv.path2id('symlink')]
         self.assertEqual(entry.kind, 'symlink')
         self.assertEqual(None, entry.text_size)

=== modified file 'bzrlib/tests/tree_implementations/test_test_trees.py'
--- a/bzrlib/tests/tree_implementations/test_test_trees.py	2007-03-01 16:48:50 +0000
+++ b/bzrlib/tests/tree_implementations/test_test_trees.py	2007-04-14 11:55:51 +0000
@@ -16,6 +16,8 @@
 
 """Tests for the test trees used by the tree_implementations tests."""
 
+from bzrlib.osutils import has_symlinks
+from bzrlib.tests import TestSkipped
 from bzrlib.tests.tree_implementations import TestCaseWithTree
 
 
@@ -146,6 +148,8 @@
         # currently this test tree requires unicode. It might be good
         # to have it simply stop having the single unicode file in it
         # when dealing with a non-unicode filesystem.
+        if not has_symlinks():
+            raise TestSkipped('No symlink support')
         tree = self.get_tree_with_subdirs_and_all_content_types()
         tree.lock_read()
         self.addCleanup(tree.unlock)
@@ -176,6 +180,38 @@
              ('1top-dir/1dir-in-1topdir', '0dir-in-1topdir', 'directory')],
             [(path, node.file_id, node.kind) for path, node in tree.iter_entries_by_dir()])
 
+    def test_tree_with_subdirs_and_all_content_types_wo_symlinks(self):
+        # currently this test tree requires unicode. It might be good
+        # to have it simply stop having the single unicode file in it
+        # when dealing with a non-unicode filesystem.
+        tree = self.get_tree_with_subdirs_and_all_supported_content_types(False)
+        tree.lock_read()
+        self.addCleanup(tree.unlock)
+        self.assertEqual([], tree.get_parent_ids())
+        self.assertEqual([], tree.conflicts())
+        self.assertEqual([], list(tree.unknowns()))
+        # __iter__ has no strongly defined order
+        tree_root = tree.path2id('')
+        self.assertEqual(
+            set([tree_root,
+                '2file',
+                '1top-dir',
+                '1file-in-1topdir',
+                '0dir-in-1topdir',
+                 u'0utf\u1234file'.encode('utf8'),
+                 ]),
+            set(iter(tree)))
+        # note that the order of the paths and fileids is deliberately 
+        # mismatched to ensure that the result order is path based.
+        self.assertEqual(
+            [('', tree_root, 'directory'),
+             ('0file', '2file', 'file'),
+             ('1top-dir', '1top-dir', 'directory'),
+             (u'2utf\u1234file', u'0utf\u1234file'.encode('utf8'), 'file'),
+             ('1top-dir/0file-in-1topdir', '1file-in-1topdir', 'file'),
+             ('1top-dir/1dir-in-1topdir', '0dir-in-1topdir', 'directory')],
+            [(path, node.file_id, node.kind) for path, node in tree.iter_entries_by_dir()])
+
     def test_tree_with_utf8(self):
         tree = self.make_branch_and_tree('.')
         tree = self.get_tree_with_utf8(tree)

=== modified file 'bzrlib/tests/tree_implementations/test_walkdirs.py'
--- a/bzrlib/tests/tree_implementations/test_walkdirs.py	2007-02-22 15:39:23 +0000
+++ b/bzrlib/tests/tree_implementations/test_walkdirs.py	2007-04-14 11:55:51 +0000
@@ -16,34 +16,53 @@
 
 """Tests for the generic Tree.walkdirs interface."""
 
+from bzrlib.osutils import has_symlinks
 from bzrlib.tests.tree_implementations import TestCaseWithTree
 
 
 class TestWalkdirs(TestCaseWithTree):
 
-    def get_all_subdirs_expected(self, tree):
-        return [
-            (('', tree.path2id('')),
-            [
-             ('0file', '0file', 'file', None, '2file', 'file'),
-             ('1top-dir', '1top-dir', 'directory', None, '1top-dir', 'directory'),
-             (u'2utf\u1234file', u'2utf\u1234file', 'file', None,
-                                     u'0utf\u1234file'.encode('utf8'), 'file'),
-             ('symlink', 'symlink', 'symlink', None, 'symlink', 'symlink')
-            ]),
-            (('1top-dir', '1top-dir'),
-            [('1top-dir/0file-in-1topdir', '0file-in-1topdir', 'file', None, '1file-in-1topdir', 'file'),
-             ('1top-dir/1dir-in-1topdir', '1dir-in-1topdir', 'directory', None, '0dir-in-1topdir', 'directory'),
-            ]),
-            (('1top-dir/1dir-in-1topdir', '0dir-in-1topdir'),
-            [
-            ]),
-            ]
+    def get_all_subdirs_expected(self, tree, symlinks):
+        if symlinks:
+            return [
+                (('', tree.path2id('')),
+                [
+                 ('0file', '0file', 'file', None, '2file', 'file'),
+                 ('1top-dir', '1top-dir', 'directory', None, '1top-dir', 'directory'),
+                 (u'2utf\u1234file', u'2utf\u1234file', 'file', None,
+                                         u'0utf\u1234file'.encode('utf8'), 'file'),
+                 ('symlink', 'symlink', 'symlink', None, 'symlink', 'symlink')
+                ]),
+                (('1top-dir', '1top-dir'),
+                [('1top-dir/0file-in-1topdir', '0file-in-1topdir', 'file', None, '1file-in-1topdir', 'file'),
+                 ('1top-dir/1dir-in-1topdir', '1dir-in-1topdir', 'directory', None, '0dir-in-1topdir', 'directory'),
+                ]),
+                (('1top-dir/1dir-in-1topdir', '0dir-in-1topdir'),
+                [
+                ]),
+                ]
+        else:
+            return [
+                (('', tree.path2id('')),
+                [
+                 ('0file', '0file', 'file', None, '2file', 'file'),
+                 ('1top-dir', '1top-dir', 'directory', None, '1top-dir', 'directory'),
+                 (u'2utf\u1234file', u'2utf\u1234file', 'file', None,
+                                         u'0utf\u1234file'.encode('utf8'), 'file'),
+                ]),
+                (('1top-dir', '1top-dir'),
+                [('1top-dir/0file-in-1topdir', '0file-in-1topdir', 'file', None, '1file-in-1topdir', 'file'),
+                 ('1top-dir/1dir-in-1topdir', '1dir-in-1topdir', 'directory', None, '0dir-in-1topdir', 'directory'),
+                ]),
+                (('1top-dir/1dir-in-1topdir', '0dir-in-1topdir'),
+                [
+                ]),
+                ]
 
     def test_walkdir_root(self):
-        tree = self.get_tree_with_subdirs_and_all_content_types()
+        tree = self.get_tree_with_subdirs_and_all_supported_content_types(has_symlinks())
         tree.lock_read()
-        expected_dirblocks = self.get_all_subdirs_expected(tree)
+        expected_dirblocks = self.get_all_subdirs_expected(tree, has_symlinks())
         # test that its iterable by iterating
         result = []
         for dirinfo, block in tree.walkdirs():
@@ -61,11 +80,11 @@
         self.assertEqual(len(expected_dirblocks), len(result))
             
     def test_walkdir_subtree(self):
-        tree = self.get_tree_with_subdirs_and_all_content_types()
+        tree = self.get_tree_with_subdirs_and_all_supported_content_types(has_symlinks())
         # test that its iterable by iterating
         result = []
         tree.lock_read()
-        expected_dirblocks = self.get_all_subdirs_expected(tree)[1:]
+        expected_dirblocks = self.get_all_subdirs_expected(tree, has_symlinks())[1:]
         for dirinfo, block in tree.walkdirs('1top-dir'):
             newblock = []
             for row in block:

=== modified file 'bzrlib/tests/workingtree_implementations/test_walkdirs.py'
--- a/bzrlib/tests/workingtree_implementations/test_walkdirs.py	2007-02-14 10:07:48 +0000
+++ b/bzrlib/tests/workingtree_implementations/test_walkdirs.py	2007-04-14 12:17:31 +0000
@@ -19,6 +19,8 @@
 import os
 
 from bzrlib import transform
+from bzrlib.osutils import has_symlinks
+from bzrlib.tests import TestSkipped
 from bzrlib.tests.workingtree_implementations import TestCaseWithWorkingTree
 
 # tests to write:
@@ -137,6 +139,8 @@
 
     def test_walkdirs_type_changes(self):
         """Walkdir shows the actual kinds on disk and the recorded kinds."""
+        if not has_symlinks():
+            raise TestSkipped('No symlink support')
         tree = self.make_branch_and_tree('.')
         paths = ['file1', 'file2', 'dir1/', 'dir2/']
         ids = ['file1', 'file2', 'dir1', 'dir2']
@@ -199,3 +203,40 @@
         for pos, item in enumerate(expected_dirblocks):
             self.assertEqual(item, result[pos])
         self.assertEqual(len(expected_dirblocks), len(result))
+
+    def test_walkdirs_type_changes_wo_symlinks(self):
+        # similar to test_walkdirs_type_changes
+        # but don't use symlinks for safe testing on win32
+        tree = self.make_branch_and_tree('.')
+        paths = ['file1', 'dir1/']
+        ids = ['file1', 'dir1']
+        self.build_tree(paths)
+        tree.add(paths, ids)
+        tree.bzrdir.root_transport.delete_tree('dir1')
+        tree.bzrdir.root_transport.delete('file1')
+        changed_paths = ['dir1', 'file1/']
+        self.build_tree(changed_paths)
+        dir1_stat = os.lstat('dir1')
+        file1_stat = os.lstat('file1')
+        expected_dirblocks = [
+             (('', tree.path2id('')),
+              [('dir1', 'dir1', 'file', dir1_stat, 'dir1', 'directory'),
+               ('file1', 'file1', 'directory', file1_stat, 'file1', 'file'),
+              ]
+             ),
+             (('dir1', 'dir1'),
+              [
+              ]
+             ),
+             (('file1', None),
+              [
+              ]
+             ),
+            ]
+        tree.lock_read()
+        result = list(tree.walkdirs())
+        tree.unlock()
+        # check each return value for debugging ease.
+        for pos, item in enumerate(expected_dirblocks):
+            self.assertEqual(item, result[pos])
+        self.assertEqual(len(expected_dirblocks), len(result))

=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py	2007-03-31 03:19:39 +0000
+++ b/bzrlib/workingtree_4.py	2007-04-14 12:18:42 +0000
@@ -99,6 +99,7 @@
 # This is the Windows equivalent of ENOTDIR
 # It is defined in pywin32.winerror, but we don't want a strong dependency for
 # just an error code.
+ERROR_PATH_NOT_FOUND = 3
 ERROR_DIRECTORY = 267
 
 
@@ -2082,13 +2083,15 @@
                     # python 2.5 has e.errno == EINVAL,
                     #            and e.winerror == ERROR_DIRECTORY
                     e_winerror = getattr(e, 'winerror', None)
+                    win_errors = (ERROR_DIRECTORY, ERROR_PATH_NOT_FOUND)
                     # there may be directories in the inventory even though
                     # this path is not a file on disk: so mark it as end of
                     # iterator
                     if e.errno in (errno.ENOENT, errno.ENOTDIR, errno.EINVAL):
                         current_dir_info = None
                     elif (sys.platform == 'win32'
-                          and ERROR_DIRECTORY in (e.errno, e_winerror)):
+                          and (e.errno in win_errors
+                               or e_winerror in win_errors)):
                         current_dir_info = None
                     else:
                         raise




More information about the bazaar-commits mailing list