Rev 4813: 2.1.0b4-win32-path-content-summary was accepted in http://bazaar.launchpad.net/~jameinel/bzr/2.1.0b4-win32-accepted
John Arbash Meinel
john at arbash-meinel.com
Mon Nov 16 20:47:28 GMT 2009
At http://bazaar.launchpad.net/~jameinel/bzr/2.1.0b4-win32-accepted
------------------------------------------------------------
revno: 4813 [merge]
revision-id: john at arbash-meinel.com-20091116204721-mwntcc54s38vaejd
parent: john at arbash-meinel.com-20091116204552-c9p6ruxi0c5lnypi
parent: john at arbash-meinel.com-20091110194013-05ajpyt4zj8q3af4
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.1.0b4-win32-accepted
timestamp: Mon 2009-11-16 14:47:21 -0600
message:
2.1.0b4-win32-path-content-summary was accepted
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/transform.py transform.py-20060105172343-dd99e54394d91687
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-08-26 05:34:10 +0000
+++ b/bzrlib/tests/per_tree/test_path_content_summary.py 2009-11-10 19:38:37 +0000
@@ -21,6 +21,7 @@
from bzrlib import (
osutils,
tests,
+ transform,
)
from bzrlib.tests import per_tree
@@ -78,13 +79,13 @@
self.assertEqual(('missing', None, None, None), summary)
def test_file_content_summary_executable(self):
- if not osutils.supports_executable():
- raise tests.TestNotApplicable()
tree = self.make_branch_and_tree('tree')
self.build_tree(['tree/path'])
tree.add(['path'])
- current_mode = os.stat('tree/path').st_mode
- os.chmod('tree/path', current_mode | 0100)
+ tt = transform.TreeTransform(tree)
+ self.addCleanup(tt.finalize)
+ tt.set_executability(True, tt.trans_id_tree_path('path'))
+ tt.apply()
summary = self._convert_tree(tree).path_content_summary('path')
self.assertEqual(4, len(summary))
self.assertEqual('file', summary[0])
@@ -95,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-10-26 06:44:40 +0000
+++ b/bzrlib/tests/test_transform.py 2009-11-10 19:40:13 +0000
@@ -2470,8 +2470,6 @@
self.assertIs(None, summary[3])
def test_change_executability(self):
- if not osutils.supports_executable():
- raise TestNotApplicable()
tree = self.make_branch_and_tree('tree')
self.build_tree(['tree/path'])
tree.add('path')
@@ -2491,10 +2489,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/transform.py'
--- a/bzrlib/transform.py 2009-10-29 21:13:16 +0000
+++ b/bzrlib/transform.py 2009-11-10 05:26:00 +0000
@@ -1973,7 +1973,7 @@
statval = os.lstat(limbo_name)
size = statval.st_size
if not supports_executable():
- executable = None
+ executable = False
else:
executable = statval.st_mode & S_IEXEC
else:
@@ -1981,8 +1981,7 @@
executable = None
if kind == 'symlink':
link_or_sha1 = os.readlink(limbo_name).decode(osutils._fs_enc)
- if supports_executable():
- executable = tt._new_executability.get(trans_id, executable)
+ executable = tt._new_executability.get(trans_id, executable)
return kind, size, executable, link_or_sha1
def iter_changes(self, from_tree, include_unchanged=False,
=== 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