Rev 5113: (abentley) RT.is_executable returns False not None for dirs and in file:///home/pqm/archives/thelove/bzr/2.2/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Wed Dec 1 04:59:16 GMT 2010


At file:///home/pqm/archives/thelove/bzr/2.2/

------------------------------------------------------------
revno: 5113 [merge]
revision-id: pqm at pqm.ubuntu.com-20101201045914-3m30v3675n478po8
parent: pqm at pqm.ubuntu.com-20101126170541-mb5tiic1mxom8hxc
parent: aaron at aaronbentley.com-20101201025216-7whnt41yrlf0xbov
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: 2.2
timestamp: Wed 2010-12-01 04:59:14 +0000
message:
  (abentley) RT.is_executable returns False not None for dirs and
  	symlinks.
added:
  bzrlib/tests/per_tree/test_is_executable.py test_is_executable.p-20101129213311-f8i0hh0y53e1gfgx-1
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/revisiontree.py         revisiontree.py-20060724012533-bg8xyryhxd0o0i0h-1
  bzrlib/tests/per_tree/__init__.py __init__.py-20060717075546-420s7b0bj9hzeowi-2
  bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
  bzrlib/workingtree_4.py        workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
=== modified file 'NEWS'
--- a/NEWS	2010-11-26 15:50:16 +0000
+++ b/NEWS	2010-12-01 02:52:16 +0000
@@ -19,6 +19,10 @@
 Bug Fixes
 *********
 
+* RevisionTree.is_executable no longer returns None for directories and
+  symlinks.  Instead, it returns False, like other Trees and methods.
+  (Aaron Bentley, #681885)
+
 Improvements
 ************
 

=== modified file 'bzrlib/revisiontree.py'
--- a/bzrlib/revisiontree.py	2010-05-06 23:41:35 +0000
+++ b/bzrlib/revisiontree.py	2010-11-29 23:35:13 +0000
@@ -110,7 +110,7 @@
     def is_executable(self, file_id, path=None):
         ie = self._inventory[file_id]
         if ie.kind != "file":
-            return None
+            return False
         return ie.executable
 
     def has_filename(self, filename):

=== modified file 'bzrlib/tests/per_tree/__init__.py'
--- a/bzrlib/tests/per_tree/__init__.py	2010-05-06 23:41:35 +0000
+++ b/bzrlib/tests/per_tree/__init__.py	2010-11-29 23:35:13 +0000
@@ -385,6 +385,7 @@
         'get_symlink_target',
         'inv',
         'iter_search_rules',
+        'is_executable',
         'list_files',
         'locking',
         'path_content_summary',

=== added file 'bzrlib/tests/per_tree/test_is_executable.py'
--- a/bzrlib/tests/per_tree/test_is_executable.py	1970-01-01 00:00:00 +0000
+++ b/bzrlib/tests/per_tree/test_is_executable.py	2010-11-29 23:35:13 +0000
@@ -0,0 +1,37 @@
+# Copyright (C) 2010 Canonical Ltd
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+from bzrlib.tests import (
+    per_tree,
+    SymlinkFeature,
+    )
+
+
+class TestIsExecutable(per_tree.TestCaseWithTree):
+
+    def test_is_executable_dir(self):
+        tree = self.get_tree_with_subdirs_and_all_supported_content_types(
+            False)
+        tree.lock_read()
+        self.addCleanup(tree.unlock)
+        self.assertEqual(False, tree.is_executable('1top-dir'))
+
+    def test_is_executable_symlink(self):
+        self.requireFeature(SymlinkFeature)
+        tree = self.get_tree_with_subdirs_and_all_content_types()
+        tree.lock_read()
+        self.addCleanup(tree.unlock)
+        self.assertEqual(False, tree.is_executable('symlink'))

=== modified file 'bzrlib/tests/test_transform.py'
--- a/bzrlib/tests/test_transform.py	2010-10-06 21:29:58 +0000
+++ b/bzrlib/tests/test_transform.py	2010-11-29 23:35:13 +0000
@@ -2344,7 +2344,7 @@
                   ('TREE_ROOT', 'TREE_ROOT'), ('a', 'a'), ('file', 'file'),
                   (False, False))
 ROOT_ENTRY = ('TREE_ROOT', ('', ''), False, (True, True), (None, None),
-              ('', ''), ('directory', 'directory'), (False, None))
+              ('', ''), ('directory', 'directory'), (False, False))
 
 
 class TestTransformPreview(tests.TestCaseWithTransport):
@@ -2437,13 +2437,13 @@
         revision_tree, preview_tree = self.get_tree_and_preview_tree()
         changes = preview_tree.iter_changes(revision_tree,
                                             specific_files=[''])
-        self.assertEqual([ROOT_ENTRY, A_ENTRY], list(changes))
+        self.assertEqual([A_ENTRY], list(changes))
 
     def test_want_unversioned(self):
         revision_tree, preview_tree = self.get_tree_and_preview_tree()
         changes = preview_tree.iter_changes(revision_tree,
                                             want_unversioned=True)
-        self.assertEqual([ROOT_ENTRY, A_ENTRY], list(changes))
+        self.assertEqual([A_ENTRY], list(changes))
 
     def test_ignore_extra_trees_no_specific_files(self):
         # extra_trees is harmless without specific_files, so we'll silently

=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py	2010-07-21 09:58:42 +0000
+++ b/bzrlib/workingtree_4.py	2010-11-29 23:35:13 +0000
@@ -1869,7 +1869,7 @@
     def is_executable(self, file_id, path=None):
         ie = self.inventory[file_id]
         if ie.kind != "file":
-            return None
+            return False
         return ie.executable
 
     def is_locked(self):




More information about the bazaar-commits mailing list