Rev 2914: Revert the changes to CommitBuilder.record_entry_contents. in http://bzr.arbash-meinel.com/branches/bzr/0.92-dev/dirstate_error_149113
John Arbash Meinel
john at arbash-meinel.com
Wed Oct 17 17:50:51 BST 2007
At http://bzr.arbash-meinel.com/branches/bzr/0.92-dev/dirstate_error_149113
------------------------------------------------------------
revno: 2914
revision-id: 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.
modified:
bzrlib/repository.py rev_storage.py-20051111201905-119e9401e46257e3
bzrlib/tests/repository_implementations/test_commit_builder.py test_commit_builder.py-20060606110838-76e3ra5slucqus81-1
-------------- next part --------------
=== modified file 'bzrlib/repository.py'
--- a/bzrlib/repository.py 2007-10-16 21:17:34 +0000
+++ b/bzrlib/repository.py 2007-10-17 16:44:05 +0000
@@ -313,7 +313,6 @@
# ancestors, we write a new node.
if len(heads) != 1:
store = True
- parent_entry = None
if not store:
# There is a single head, look it up for comparison
parent_entry = parent_candiate_entries[heads[0]]
@@ -328,14 +327,8 @@
if kind != parent_entry.kind:
store = True
if kind == 'file':
- if content_summary[2] is None:
- if parent_entry is not None:
- executable = parent_entry.executable
- else:
- executable = False
- content_summary = (content_summary[0], content_summary[1],
- executable,
- ) + content_summary[3:]
+ 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/repository_implementations/test_commit_builder.py'
--- a/bzrlib/tests/repository_implementations/test_commit_builder.py 2007-10-16 21:17:34 +0000
+++ b/bzrlib/tests/repository_implementations/test_commit_builder.py 2007-10-17 16:44:05 +0000
@@ -536,68 +536,3 @@
def test_last_modified_file_link(self):
self._check_kind_change(self.make_file, self.make_link)
-
- def test_record_entry_contents_exec_None(self):
- # When content_summary returns None for executable, we will still set
- # it to a value
- tree = self.make_branch_and_tree('.')
- self.build_tree(['file'])
- tree.add(['file'], ['file-id'])
-
- _orig_path_content_summary = tree.path_content_summary
-
- def path_content_summary_exec_None(path):
- summary = _orig_path_content_summary(path)
- if path == 'file':
- summary = (summary[0], summary[1], None) + summary[3:]
- return summary
-
- def path_content_summary_exec_True(path):
- summary = _orig_path_content_summary(path)
- if path == 'file':
- summary = (summary[0], summary[1], True) + summary[3:]
- return summary
-
- def path_content_summary_exec_False(path):
- summary = _orig_path_content_summary(path)
- if path == 'file':
- summary = (summary[0], summary[1], False) + summary[3:]
- return summary
-
-
- tree.path_content_summary = path_content_summary_exec_None
- rev_id = tree.commit('')
- rev_tree = tree.branch.repository.revision_tree(rev_id)
- executable = rev_tree.inventory['file-id'].executable
- self.assertIsNot(None, executable)
- self.assertFalse(executable)
-
- tree.path_content_summary = path_content_summary_exec_True
- rev_id = self.mini_commit(tree, 'file', 'file', True, True)
- rev_tree = tree.branch.repository.revision_tree(rev_id)
- executable = rev_tree.inventory['file-id'].executable
- self.assertIsNot(None, executable)
- self.assertTrue(executable)
-
- # Now with path_content_summary_exec_None, there should be no change
- tree.path_content_summary = path_content_summary_exec_None
- rev_id = self.mini_commit(tree, 'file', 'file', False, False)
- rev_tree = tree.branch.repository.revision_tree(rev_id)
- executable = rev_tree.inventory['file-id'].executable
- self.assertIsNot(None, executable)
- self.assertTrue(executable)
-
- # Now we set the exec back to False, which should also be preserved
- tree.path_content_summary = path_content_summary_exec_False
- rev_id = self.mini_commit(tree, 'file', 'file', True, True)
- rev_tree = tree.branch.repository.revision_tree(rev_id)
- executable = rev_tree.inventory['file-id'].executable
- self.assertIsNot(None, executable)
- self.assertFalse(executable)
-
- tree.path_content_summary = path_content_summary_exec_None
- rev_id = self.mini_commit(tree, 'file', 'file', False, False)
- rev_tree = tree.branch.repository.revision_tree(rev_id)
- executable = rev_tree.inventory['file-id'].executable
- self.assertIsNot(None, executable)
- self.assertFalse(executable)
More information about the bazaar-commits
mailing list