~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_workingtree.py

  • Committer: John Arbash Meinel
  • Date: 2006-06-26 19:52:45 UTC
  • mto: (1711.7.2 win32)
  • mto: This revision was merged to the branch mainline in revision 1822.
  • Revision ID: john@arbash-meinel.com-20060626195245-acaff85631d5a558
Add a test that executable=yes exists in .bzr/checkout/inventory

Show diffs side-by-side

added added

removed removed

Lines of Context:
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,
32
33
                                WorkingTree)
202
203
        tree.unlock()
203
204
        self.assertEquals(our_lock.peek(), None)
204
205
 
 
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()
 
211
        try:
 
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)
 
218
        tt.apply()
 
219
 
 
220
        t = control.get_workingtree_transport(None)
 
221
        inventory_text = (
 
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'
 
225
                '</inventory>\n'
 
226
                )
 
227
        # Check that the executable flag is set in the XML
 
228
        self.assertEqualDiff(inventory_text, t.get('inventory').read())
 
229
 
 
230
        # Committing shouldn't remove it
 
231
        tree.commit('first rev')
 
232
        self.assertEqualDiff(inventory_text, t.get('inventory').read())
 
233
 
 
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())
 
238
 
205
239
 
206
240
class TestFormat2WorkingTree(TestCaseWithTransport):
207
241
    """Tests that are specific to format 2 trees."""