/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/workingtree_implementations/test_workingtree.py

  • Committer: Jelmer Vernooij
  • Date: 2009-02-25 14:36:59 UTC
  • mfrom: (4048 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4049.
  • Revision ID: jelmer@samba.org-20090225143659-vx6cbqtmyicuzfyf
Merge bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
151
151
        self.assertEqual('w', tree.branch.peek_lock_mode())
152
152
        tree.unlock()
153
153
        self.assertEqual(None, tree.branch.peek_lock_mode())
154
 
 
 
154
 
155
155
    def test_revert(self):
156
156
        """Test selected-file revert"""
157
157
        tree = self.make_branch_and_tree('.')
177
177
        tree.revert(['hello.txt'])
178
178
        self.check_file_contents('hello.txt', 'initial hello')
179
179
        self.check_file_contents('hello.txt.~1~', 'new hello')
180
 
        
 
180
 
181
181
        # backup files are numbered
182
182
        file('hello.txt', 'w').write('new hello2')
183
183
        tree.revert(['hello.txt'])
234
234
 
235
235
        revid = b.revision_history()[0]
236
236
        self.log('first revision_id is {%s}' % revid)
237
 
        
 
237
 
238
238
        inv = b.repository.get_revision_inventory(revid)
239
239
        self.log('contents of inventory: %r' % inv.entries())
240
240
 
329
329
 
330
330
    def test_set_last_revision_different_to_branch(self):
331
331
        # working tree formats from the meta-dir format and newer support
332
 
        # setting the last revision on a tree independently of that on the 
333
 
        # branch. Its concievable that some future formats may want to 
 
332
        # setting the last revision on a tree independently of that on the
 
333
        # branch. Its concievable that some future formats may want to
334
334
        # couple them again (i.e. because its really a smart server and
335
335
        # the working tree will always match the branch). So we test
336
 
        # that formats where initialising a branch does not initialise a 
337
 
        # tree - and thus have separable entities - support skewing the 
 
336
        # that formats where initialising a branch does not initialise a
 
337
        # tree - and thus have separable entities - support skewing the
338
338
        # two things.
339
339
        branch = self.make_branch('tree')
340
340
        try:
378
378
        self.assertEqual('added', cloned.path2id('added'))
379
379
        self.assertEqual(None, cloned.path2id('deleted'))
380
380
        self.assertEqual(None, cloned.path2id('notadded'))
381
 
        
 
381
 
382
382
    def test_basis_tree_returns_last_revision(self):
383
383
        wt = self.make_branch_and_tree('.')
384
384
        self.build_tree(['foo'])
410
410
        # not change between two revisions, and another that does -
411
411
        # if the changed one is not changed, fail,
412
412
        # if the one that did not change has lost a local change, fail.
413
 
        # 
 
413
        #
414
414
        raise TestSkipped('revision limiting is not implemented yet.')
415
415
 
416
416
    def test_initialize_with_revision_id(self):
427
427
 
428
428
    def test_update_sets_last_revision(self):
429
429
        # working tree formats from the meta-dir format and newer support
430
 
        # setting the last revision on a tree independently of that on the 
431
 
        # branch. Its concievable that some future formats may want to 
 
430
        # setting the last revision on a tree independently of that on the
 
431
        # branch. Its concievable that some future formats may want to
432
432
        # couple them again (i.e. because its really a smart server and
433
433
        # the working tree will always match the branch). So we test
434
 
        # that formats where initialising a branch does not initialise a 
435
 
        # tree - and thus have separable entities - support skewing the 
 
434
        # that formats where initialising a branch does not initialise a
 
435
        # tree - and thus have separable entities - support skewing the
436
436
        # two things.
437
437
        main_branch = self.make_branch('tree')
438
438
        try:
458
458
 
459
459
    def test_update_sets_root_id(self):
460
460
        """Ensure tree root is set properly by update.
461
 
        
 
461
 
462
462
        Since empty trees don't have root_ids, but workingtrees do,
463
463
        an update of a checkout of revision 0 to a new revision,  should set
464
464
        the root id.
472
472
        # now commit to 'tree'
473
473
        wt.add('file')
474
474
        wt.commit('A', rev_id='A')
475
 
        # and update checkout 
 
475
        # and update checkout
476
476
        self.assertEqual(0, checkout.update())
477
477
        self.failUnlessExists('checkout/file')
478
478
        self.assertEqual(wt.get_root_id(), checkout.get_root_id())
480
480
 
481
481
    def test_update_returns_conflict_count(self):
482
482
        # working tree formats from the meta-dir format and newer support
483
 
        # setting the last revision on a tree independently of that on the 
484
 
        # branch. Its concievable that some future formats may want to 
 
483
        # setting the last revision on a tree independently of that on the
 
484
        # branch. Its concievable that some future formats may want to
485
485
        # couple them again (i.e. because its really a smart server and
486
486
        # the working tree will always match the branch). So we test
487
 
        # that formats where initialising a branch does not initialise a 
488
 
        # tree - and thus have separable entities - support skewing the 
 
487
        # that formats where initialising a branch does not initialise a
 
488
        # tree - and thus have separable entities - support skewing the
489
489
        # two things.
490
490
        main_branch = self.make_branch('tree')
491
491
        try:
553
553
 
554
554
    def test_update_turns_local_commit_into_merge(self):
555
555
        # doing an update with a few local commits and no master commits
556
 
        # makes pending-merges. 
 
556
        # makes pending-merges.
557
557
        # this is done so that 'bzr update; bzr revert' will always produce
558
558
        # an exact copy of the 'logical branch' - the referenced branch for
559
559
        # a checkout, and the master for a bound branch.
612
612
            tree.set_conflicts(example_conflicts)
613
613
        except UnsupportedOperation:
614
614
            raise TestSkipped('set_conflicts not supported')
615
 
            
 
615
 
616
616
        tree2 = WorkingTree.open('master')
617
617
        self.assertEqual(tree2.conflicts(), example_conflicts)
618
618
        tree2._transport.put_bytes('conflicts', '')
661
661
        self.assertEqual(ConflictList([TextConflict('path_a')]),
662
662
                         tree.conflicts())
663
663
        tree.add_conflicts([TextConflict('path_a')])
664
 
        self.assertEqual(ConflictList([TextConflict('path_a')]), 
 
664
        self.assertEqual(ConflictList([TextConflict('path_a')]),
665
665
                         tree.conflicts())
666
666
        tree.add_conflicts([ContentsConflict('path_a')])
667
 
        self.assertEqual(ConflictList([ContentsConflict('path_a'), 
 
667
        self.assertEqual(ConflictList([ContentsConflict('path_a'),
668
668
                                       TextConflict('path_a')]),
669
669
                         tree.conflicts())
670
670
        tree.add_conflicts([TextConflict('path_b')])
671
 
        self.assertEqual(ConflictList([ContentsConflict('path_a'), 
 
671
        self.assertEqual(ConflictList([ContentsConflict('path_a'),
672
672
                                       TextConflict('path_a'),
673
673
                                       TextConflict('path_b')]),
674
674
                         tree.conflicts())
726
726
            tree.add([u'a\u030a'])
727
727
            tree.lock_read()
728
728
            self.assertEqual([('', 'directory'), (u'\xe5', 'file')],
729
 
                    [(path, ie.kind) for path,ie in 
 
729
                    [(path, ie.kind) for path,ie in
730
730
                                tree.inventory.iter_entries()])
731
731
            tree.unlock()
732
732
        finally: