27
27
from bzrlib.osutils import pathjoin, getcwd, has_symlinks
28
28
from bzrlib.tests import TestCaseWithTransport, TestSkipped
29
29
from bzrlib.trace import mutter
30
from bzrlib.transform import TreeTransform
30
31
from bzrlib.transport import get_transport
31
32
from bzrlib.workingtree import (TreeEntry, TreeDirectory, TreeFile, TreeLink,
203
204
self.assertEquals(our_lock.peek(), None)
206
def test_executable(self):
207
"""Format 3 trees should keep executable=yes in the working inventory."""
208
control = bzrdir.BzrDirMetaFormat1().initialize(self.get_url())
209
control.create_repository()
210
control.create_branch()
212
tree = workingtree.WorkingTreeFormat3().initialize(control)
213
except errors.NotLocalUrl:
214
raise TestSkipped('Not a local URL')
215
tt = TreeTransform(tree)
216
tt.new_file('a', tt.root, 'contents of a\n', 'a-xxyy', True)
217
tt.new_file('b', tt.root, 'contents of b\n', 'b-xxyy', False)
220
t = control.get_workingtree_transport(None)
222
'<inventory format="5">\n'
223
'<file executable="yes" file_id="a-xxyy" name="a" />\n'
224
'<file file_id="b-xxyy" name="b" />\n'
227
# Check that the executable flag is set in the XML
228
self.assertEqualDiff(inventory_text, t.get('inventory').read())
230
# Committing shouldn't remove it
231
tree.commit('first rev')
232
self.assertEqualDiff(inventory_text, t.get('inventory').read())
234
# And neither should reverting
235
last_tree = tree.branch.repository.revision_tree(tree.last_revision())
236
tree.revert([], last_tree, backups=False)
237
self.assertEqualDiff(inventory_text, t.get('inventory').read())
206
240
class TestFormat2WorkingTree(TestCaseWithTransport):
207
241
"""Tests that are specific to format 2 trees."""