402
401
a_id = "a-20051208024829-849e76f7968d7a86"
403
402
b_id = "b-20051208024829-849e76f7968d7a86"
404
t = WorkingTree('b1', b)
405
self.assertEqual(['a', 'b'], [cn for cn,ie in t.inventory.iter_entries()])
407
self.failUnless(t.is_executable(a_id), "'a' lost the execute bit")
408
self.failIf(t.is_executable(b_id), "'b' gained an execute bit")
410
t.commit('adding a,b', rev_id='r1')
403
wt = wt.bzrdir.open_workingtree()
404
self.assertEqual(['a', 'b'], [cn for cn,ie in wt.inventory.iter_entries()])
406
self.failUnless(wt.is_executable(a_id), "'a' lost the execute bit")
407
self.failIf(wt.is_executable(b_id), "'b' gained an execute bit")
409
wt.commit('adding a,b', rev_id='r1')
412
411
rev_tree = b.repository.revision_tree('r1')
413
412
self.failUnless(rev_tree.is_executable(a_id), "'a' lost the execute bit")
419
418
# Make sure the entries are gone
420
419
os.remove('b1/a')
421
420
os.remove('b1/b')
422
self.failIf(t.has_id(a_id))
423
self.failIf(t.has_filename('a'))
424
self.failIf(t.has_id(b_id))
425
self.failIf(t.has_filename('b'))
421
self.failIf(wt.has_id(a_id))
422
self.failIf(wt.has_filename('a'))
423
self.failIf(wt.has_id(b_id))
424
self.failIf(wt.has_filename('b'))
427
426
# Make sure that revert is able to bring them back,
428
427
# and sets 'a' back to being executable
430
t.revert(['a', 'b'], rev_tree, backups=False)
431
self.assertEqual(['a', 'b'], [cn for cn,ie in t.inventory.iter_entries()])
429
wt.revert(['a', 'b'], rev_tree, backups=False)
430
self.assertEqual(['a', 'b'], [cn for cn,ie in wt.inventory.iter_entries()])
433
self.failUnless(t.is_executable(a_id), "'a' lost the execute bit")
434
self.failIf(t.is_executable(b_id), "'b' gained an execute bit")
432
self.failUnless(wt.is_executable(a_id), "'a' lost the execute bit")
433
self.failIf(wt.is_executable(b_id), "'b' gained an execute bit")
436
435
# Now remove them again, and make sure that after a
437
436
# commit, they are still marked correctly
438
437
os.remove('b1/a')
439
438
os.remove('b1/b')
440
t.commit('removed', rev_id='r2')
439
wt.commit('removed', rev_id='r2')
442
self.assertEqual([], [cn for cn,ie in t.inventory.iter_entries()])
443
self.failIf(t.has_id(a_id))
444
self.failIf(t.has_filename('a'))
445
self.failIf(t.has_id(b_id))
446
self.failIf(t.has_filename('b'))
441
self.assertEqual([], [cn for cn,ie in wt.inventory.iter_entries()])
442
self.failIf(wt.has_id(a_id))
443
self.failIf(wt.has_filename('a'))
444
self.failIf(wt.has_id(b_id))
445
self.failIf(wt.has_filename('b'))
448
447
# Now revert back to the previous commit
449
t.revert([], rev_tree, backups=False)
450
# TODO: FIXME: For some reason, after revert, the tree does not
451
# regenerate its working inventory, so we have to manually delete
452
# the working tree, and create a new one
453
# This seems to happen any time you do a merge operation on the
456
t = WorkingTree('b1', b)
458
self.assertEqual(['a', 'b'], [cn for cn,ie in t.inventory.iter_entries()])
460
self.failUnless(t.is_executable(a_id), "'a' lost the execute bit")
461
self.failIf(t.is_executable(b_id), "'b' gained an execute bit")
448
wt.revert([], rev_tree, backups=False)
449
self.assertEqual(['a', 'b'], [cn for cn,ie in wt.inventory.iter_entries()])
451
self.failUnless(wt.is_executable(a_id), "'a' lost the execute bit")
452
self.failIf(wt.is_executable(b_id), "'b' gained an execute bit")
463
454
# Now make sure that 'bzr branch' also preserves the