Rev 2918: (John Arbash Meinel) Fix bug #149113 by always returning True/False from path_content_summary for files. in file:///home/pqm/archives/thelove/bzr/%2Btrunk/
Canonical.com Patch Queue Manager
pqm at pqm.ubuntu.com
Fri Oct 19 18:00:13 BST 2007
At file:///home/pqm/archives/thelove/bzr/%2Btrunk/
------------------------------------------------------------
revno: 2918
revision-id: pqm at pqm.ubuntu.com-20071019170010-qyc4akzhu3rdko4b
parent: pqm at pqm.ubuntu.com-20071019042839-xwvsz0loa77yokxm
parent: john at arbash-meinel.com-20071017170306-20w50sk1djh0i14k
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2007-10-19 18:00:10 +0100
message:
(John Arbash Meinel) Fix bug #149113 by always returning True/False from path_content_summary for files.
modified:
NEWS NEWS-20050323055033-4e00b5db738777ff
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
bzrlib/tests/workingtree_implementations/test_executable.py test_executable.py-20060628162557-tr7h57kl80l3ma8i-1
bzrlib/workingtree.py workingtree.py-20050511021032-29b6ec0a681e02e3
bzrlib/workingtree_4.py workingtree_4.py-20070208044105-5fgpc5j3ljlh5q6c-1
------------------------------------------------------------
revno: 2911.5.4
merged: john at arbash-meinel.com-20071017170306-20w50sk1djh0i14k
parent: john at arbash-meinel.com-20071017164405-fzauwbvx9wbwbtt5
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: dirstate_error_149113
timestamp: Wed 2007-10-17 12:03:06 -0500
message:
Switch around to properly look up the executable bit in the basis.
We do this with a load-time switch around supports_executable(), rather than
a runtime if supports_executable() check.
It would be nice to inline the _is_executable_* check on platforms that support
executable, but we had a function call before, so we haven't degraded
performance.
------------------------------------------------------------
revno: 2911.5.3
merged: john at arbash-meinel.com-20071017164405-fzauwbvx9wbwbtt5
parent: john at arbash-meinel.com-20071016221259-mfm1vbvtsdoi5sac
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: dirstate_error_149113
timestamp: Wed 2007-10-17 11:44:05 -0500
message:
Revert the changes to CommitBuilder.record_entry_contents.
------------------------------------------------------------
revno: 2911.5.2
merged: john at arbash-meinel.com-20071016221259-mfm1vbvtsdoi5sac
parent: john at arbash-meinel.com-20071016211734-u0ce8cr11khccb65
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: dirstate_error_149113
timestamp: Tue 2007-10-16 17:12:59 -0500
message:
Ensure that WT3 properly extracts the executable bit from the basis inventory.
------------------------------------------------------------
revno: 2911.5.1
merged: john at arbash-meinel.com-20071016211734-u0ce8cr11khccb65
parent: pqm at pqm.ubuntu.com-20071016112750-1q8brfaq6metpfn8
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: dirstate_error_149113
timestamp: Tue 2007-10-16 16:17:34 -0500
message:
Fix bug #149113 so that executable is properly set on win32.
The new path_content_summary() returns None when a platform
does not support the executable bit, asking the caller to
decide a policy.
This patch changes CommitBuilder.record_entry_contents()
so that it sets a policy of using the parent's value,
unless there are no parents, in which case it uses None.
=== modified file 'NEWS'
--- a/NEWS 2007-10-18 02:48:24 +0000
+++ b/NEWS 2007-10-19 17:00:10 +0000
@@ -85,6 +85,9 @@
BUG FIXES:
+ * Fix a problem with Win32 handling of the executable bit.
+ (John Arbash Meinel, #149113)
+
* ``bzr+ssh://`` and ``sftp://`` URLs that do not specify ports explicitly
no longer assume that means port 22. This allows people using OpenSSH to
override the default port in their ``~/.ssh/config`` if they wish. This
=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py 2007-10-19 04:28:39 +0000
+++ b/bzrlib/repository.py 2007-10-19 17:00:10 +0000
@@ -318,6 +318,8 @@
if kind != parent_entry.kind:
store = True
if kind == 'file':
+ assert content_summary[2] is not None, \
+ "Files must not have executable = None"
if not store:
if (# if the file length changed we have to store:
parent_entry.text_size != content_summary[1] or
=== modified file 'bzrlib/tests/workingtree_implementations/test_executable.py'
--- a/bzrlib/tests/workingtree_implementations/test_executable.py 2007-08-29 16:09:51 +0000
+++ b/bzrlib/tests/workingtree_implementations/test_executable.py 2007-10-17 17:03:06 +0000
@@ -18,6 +18,9 @@
import os
+from bzrlib import (
+ osutils,
+ )
from bzrlib.inventory import InventoryFile
from bzrlib.transform import TreeTransform
from bzrlib.tests.workingtree_implementations import TestCaseWithWorkingTree
@@ -175,3 +178,22 @@
self.wt.revert(old_tree=rev_tree, backups=False)
self.check_exist(self.wt)
+ def test_commit_with_exec_from_basis(self):
+ self.wt._is_executable_from_path_and_stat = \
+ self.wt._is_executable_from_path_and_stat_from_basis
+ rev_id1 = self.wt.commit('one')
+ rev_tree1 = self.wt.branch.repository.revision_tree(rev_id1)
+ a_executable = rev_tree1.inventory[self.a_id].executable
+ b_executable = rev_tree1.inventory[self.b_id].executable
+ self.assertIsNot(None, a_executable)
+ self.assertTrue(a_executable)
+ self.assertIsNot(None, b_executable)
+ self.assertFalse(b_executable)
+
+ def test_use_exec_from_basis(self):
+ if osutils.supports_executable():
+ self.assertEqual(self.wt._is_executable_from_path_and_stat_from_stat,
+ self.wt._is_executable_from_path_and_stat)
+ else:
+ self.assertEqual(self.wt._is_executable_from_path_and_stat_from_basis,
+ self.wt._is_executable_from_path_and_stat)
=== modified file 'bzrlib/workingtree.py'
--- a/bzrlib/workingtree.py 2007-10-08 07:29:57 +0000
+++ b/bzrlib/workingtree.py 2007-10-17 17:03:06 +0000
@@ -599,9 +599,20 @@
path = self.inventory.id2path(file_id)
return os.lstat(self.abspath(path)).st_mtime
+ def _is_executable_from_path_and_stat_from_basis(self, path, stat_result):
+ file_id = self.path2id(path)
+ return self._inventory[file_id].executable
+
+ def _is_executable_from_path_and_stat_from_stat(self, path, stat_result):
+ mode = stat_result.st_mode
+ return bool(stat.S_ISREG(mode) and stat.S_IEXEC & mode)
+
if not supports_executable():
def is_executable(self, file_id, path=None):
return self._inventory[file_id].executable
+
+ _is_executable_from_path_and_stat = \
+ _is_executable_from_path_and_stat_from_basis
else:
def is_executable(self, file_id, path=None):
if not path:
@@ -609,6 +620,9 @@
mode = os.lstat(self.abspath(path)).st_mode
return bool(stat.S_ISREG(mode) and stat.S_IEXEC & mode)
+ _is_executable_from_path_and_stat = \
+ _is_executable_from_path_and_stat_from_stat
+
@needs_tree_write_lock
def _add(self, files, ids, kinds):
"""See MutableTree._add."""
@@ -705,11 +719,7 @@
if kind == 'file':
size = stat_result.st_size
# try for a stat cache lookup
- if not supports_executable():
- executable = None # caller can decide policy.
- else:
- mode = stat_result.st_mode
- executable = bool(stat.S_ISREG(mode) and stat.S_IEXEC & mode)
+ executable = self._is_executable_from_path_and_stat(path, stat_result)
return (kind, size, executable, self._sha_from_stat(
path, stat_result))
elif kind == 'directory':
=== modified file 'bzrlib/workingtree_4.py'
--- a/bzrlib/workingtree_4.py 2007-10-09 06:28:04 +0000
+++ b/bzrlib/workingtree_4.py 2007-10-17 17:03:06 +0000
@@ -467,6 +467,12 @@
path_utf8 = osutils.pathjoin(entry[0][0], entry[0][1])
return path_utf8.decode('utf8')
+ def _is_executable_from_path_and_stat_from_basis(self, path, stat_result):
+ entry = self._get_entry(path=path)
+ if entry == (None, None):
+ return False # Missing entries are not executable
+ return entry[1][0][3] # Executable?
+
if not osutils.supports_executable():
def is_executable(self, file_id, path=None):
"""Test if a file is executable or not.
@@ -477,6 +483,9 @@
if entry == (None, None):
return False
return entry[1][0][3]
+
+ _is_executable_from_path_and_stat = \
+ _is_executable_from_path_and_stat_from_basis
else:
def is_executable(self, file_id, path=None):
"""Test if a file is executable or not.
More information about the bazaar-commits
mailing list