~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_inv.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-04-19 08:31:08 UTC
  • mfrom: (1666.1.5 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20060419083108-fab2970f4575b010
Change the default branch format to be metadir. (Robert Collins, Aaron Bentley).

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
import bzrlib.inventory as inventory
25
25
from bzrlib.osutils import has_symlinks, rename, pathjoin
26
26
from bzrlib.tests import TestCase, TestCaseWithTransport
 
27
from bzrlib.uncommit import uncommit
27
28
 
28
29
 
29
30
class TestInventory(TestCase):
339
340
        self.wt.add(['file'], ['fileid'])
340
341
        self.wt.commit('add file', rev_id='B')
341
342
        self.inv_B = self.branch.repository.get_inventory('B')
342
 
        self.branch.lock_write()
343
 
        try:
344
 
            self.branch.control_files.put_utf8('revision-history', 'A\n')
345
 
        finally:
346
 
            self.branch.unlock()
 
343
        uncommit(self.branch, tree=self.wt)
347
344
        self.assertEqual(self.branch.revision_history(), ['A'])
348
345
        self.wt.commit('another add of file', rev_id='C')
349
346
        self.inv_C = self.branch.repository.get_inventory('C')
391
388
class TestExecutable(TestCaseWithTransport):
392
389
 
393
390
    def test_stays_executable(self):
394
 
        basic_inv = """<inventory format="5">
395
 
<file file_id="a-20051208024829-849e76f7968d7a86" name="a" executable="yes" />
396
 
<file file_id="b-20051208024829-849e76f7968d7a86" name="b" />
397
 
</inventory>
398
 
"""
 
391
        a_id = "a-20051208024829-849e76f7968d7a86"
 
392
        b_id = "b-20051208024829-849e76f7968d7a86"
399
393
        wt = self.make_branch_and_tree('b1')
400
394
        b = wt.branch
401
395
        open('b1/a', 'wb').write('a test\n')
402
396
        open('b1/b', 'wb').write('b test\n')
403
397
        os.chmod('b1/a', 0755)
404
398
        os.chmod('b1/b', 0644)
405
 
        # Manually writing the inventory, to ensure that
406
 
        # the executable="yes" entry is set for 'a' and not for 'b'
407
 
        open('b1/.bzr/inventory', 'wb').write(basic_inv)
 
399
        wt.add(['a', 'b'], [a_id, b_id])
 
400
        wt.inventory[a_id].executable = True
 
401
        self.failUnless(wt.is_executable(a_id), "'a' lost the execute bit")
408
402
 
409
 
        a_id = "a-20051208024829-849e76f7968d7a86"
410
 
        b_id = "b-20051208024829-849e76f7968d7a86"
 
403
        # reopen the tree and ensure it stuck.
411
404
        wt = wt.bzrdir.open_workingtree()
412
405
        self.assertEqual(['a', 'b'], [cn for cn,ie in wt.inventory.iter_entries()])
413
406