Rev 4812: Merge the path-content-summary and preview tree test tweaks. in http://bazaar.launchpad.net/~jameinel/bzr/2.1.0b4-win32-test-suite

John Arbash Meinel john at arbash-meinel.com
Tue Nov 10 19:42:08 GMT 2009


At http://bazaar.launchpad.net/~jameinel/bzr/2.1.0b4-win32-test-suite

------------------------------------------------------------
revno: 4812 [merge]
revision-id: john at arbash-meinel.com-20091110194201-3fsl0pdr9t1wive5
parent: john at arbash-meinel.com-20091110070213-ycv91gpurcjtyt85
parent: john at arbash-meinel.com-20091110194013-05ajpyt4zj8q3af4
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.1.0b4-win32-test-suite
timestamp: Tue 2009-11-10 13:42:01 -0600
message:
  Merge the path-content-summary and preview tree test tweaks.
  
  Requires resolving a small conflict, because a test that was raising the
  wrong exception now doesn't need to raise anything.
modified:
  bzrlib/tests/per_tree/test_path_content_summary.py test_path_content_su-20070904100855-3vrwedz6akn34kl5-1
  bzrlib/tests/test_transform.py test_transaction.py-20060105172520-b3ffb3946550e6c4
  bzrlib/workingtree.py          workingtree.py-20050511021032-29b6ec0a681e02e3
-------------- next part --------------
=== modified file 'bzrlib/tests/per_tree/test_path_content_summary.py'
--- a/bzrlib/tests/per_tree/test_path_content_summary.py	2009-11-10 05:26:00 +0000
+++ b/bzrlib/tests/per_tree/test_path_content_summary.py	2009-11-10 19:38:37 +0000
@@ -96,6 +96,28 @@
         self.assertSubset((summary[3],),
             (None, '0c352290ae1c26ca7f97d5b2906c4624784abd60'))
 
+    def test_file_content_summary_not_versioned(self):
+        tree = self.make_branch_and_tree('tree')
+        self.build_tree(['tree/path'])
+        tree = self._convert_tree(tree)
+        summary = tree.path_content_summary('path')
+        self.assertEqual(4, len(summary))
+        if isinstance(tree, (per_tree.DirStateRevisionTree,
+                             per_tree.RevisionTree)):
+            self.assertEqual('missing', summary[0])
+            self.assertIs(None, summary[2])
+            self.assertIs(None, summary[3])
+        elif isinstance(tree, transform._PreviewTree):
+            self.expectFailure('PreviewTree returns "missing" for unversioned'
+                'files', self.assertEqual, 'file', summary[0])
+            self.assertEqual('file', summary[0])
+        else:
+            self.assertEqual('file', summary[0])
+            self.check_content_summary_size(tree, summary, 22)
+            self.assertEqual(False, summary[2])
+        self.assertSubset((summary[3],),
+            (None, '0c352290ae1c26ca7f97d5b2906c4624784abd60'))
+
     def test_file_content_summary_non_exec(self):
         tree = self.make_branch_and_tree('tree')
         self.build_tree(['tree/path'])

=== modified file 'bzrlib/tests/test_transform.py'
--- a/bzrlib/tests/test_transform.py	2009-11-08 20:35:33 +0000
+++ b/bzrlib/tests/test_transform.py	2009-11-10 19:42:01 +0000
@@ -2473,9 +2473,6 @@
         self.assertIs(None, summary[3])
 
     def test_change_executability(self):
-        if not osutils.supports_executable():
-            raise tests.TestNotApplicable('platform does not track the'
-                                          ' executable bit')
         tree = self.make_branch_and_tree('tree')
         self.build_tree(['tree/path'])
         tree.add('path')
@@ -2495,10 +2492,7 @@
         # size must be known
         self.assertEqual(len('contents'), summary[1])
         # not executable
-        if osutils.supports_executable():
-            self.assertEqual(False, summary[2])
-        else:
-            self.assertEqual(None, summary[2])
+        self.assertEqual(False, summary[2])
         # will not have hash (not cheap to determine)
         self.assertIs(None, summary[3])
 

=== modified file 'bzrlib/workingtree.py'
--- a/bzrlib/workingtree.py	2009-10-06 14:40:37 +0000
+++ b/bzrlib/workingtree.py	2009-11-10 09:14:34 +0000
@@ -636,6 +636,10 @@
 
     def _is_executable_from_path_and_stat_from_basis(self, path, stat_result):
         file_id = self.path2id(path)
+        if file_id is None:
+            # For unversioned files on win32, we just assume they are not
+            # executable
+            return False
         return self._inventory[file_id].executable
 
     def _is_executable_from_path_and_stat_from_stat(self, path, stat_result):



More information about the bazaar-commits mailing list