/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/test_conflicts.py

  • Committer: Jelmer Vernooij
  • Date: 2011-01-23 00:24:17 UTC
  • mto: (5622.4.1 uninstall-hook)
  • mto: This revision was merged to the branch mainline in revision 5669.
  • Revision ID: jelmer@samba.org-20110123002417-1vnpr8dvkz8ysfhd
more tests.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005-2010 Canonical Ltd
 
1
# Copyright (C) 2005-2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
18
18
import os
19
19
 
20
20
from bzrlib import (
21
 
    branchbuilder,
22
21
    bzrdir,
23
22
    conflicts,
24
23
    errors,
25
24
    option,
26
25
    tests,
27
 
    workingtree,
28
 
    )
29
 
from bzrlib.tests import script
30
 
 
31
 
 
32
 
def load_tests(standard_tests, module, loader):
33
 
    result = loader.suiteClass()
34
 
 
35
 
    sp_tests, remaining_tests = tests.split_suite_by_condition(
36
 
        standard_tests, tests.condition_isinstance((
37
 
                TestParametrizedResolveConflicts,
38
 
                )))
39
 
    # Each test class defines its own scenarios. This is needed for
40
 
    # TestResolvePathConflictBefore531967 that verifies that the same tests as
41
 
    # TestResolvePathConflict still pass.
42
 
    for test in tests.iter_suite_tests(sp_tests):
43
 
        tests.apply_scenarios(test, test.scenarios(), result)
44
 
 
45
 
    # No parametrization for the remaining tests
46
 
    result.addTests(remaining_tests)
47
 
 
48
 
    return result
 
26
    )
 
27
from bzrlib.tests import (
 
28
    script,
 
29
    scenarios,
 
30
    )
 
31
 
 
32
 
 
33
load_tests = scenarios.load_tests_apply_scenarios
49
34
 
50
35
 
51
36
# TODO: Test commit with some added, and added-but-missing files
210
195
        self.run_script(self.preamble)
211
196
 
212
197
 
213
 
class TestResolveTextConflicts(TestResolveConflicts):
214
 
    # TBC
215
 
    pass
216
 
 
217
 
 
218
198
def mirror_scenarios(base_scenarios):
219
199
    """Return a list of mirrored scenarios.
220
200
 
293
273
    _this = None
294
274
    _other = None
295
275
 
296
 
    @staticmethod
297
 
    def scenarios():
298
 
        """Return the scenario list for the conflict type defined by the class.
299
 
 
300
 
        Each scenario is of the form:
301
 
        (common, (left_name, left_dict), (right_name, right_dict))
302
 
 
303
 
        * common is a dict
304
 
 
305
 
        * left_name and right_name are the scenario names that will be combined
306
 
 
307
 
        * left_dict and right_dict are the attributes specific to each half of
308
 
          the scenario. They should include at least 'actions' and 'check' and
309
 
          will be available as '_this' and '_other' test instance attributes.
310
 
 
311
 
        Daughters classes are free to add their specific attributes as they see
312
 
        fit in any of the three dicts.
313
 
 
314
 
        This is a class method so that load_tests can find it.
315
 
 
316
 
        '_base_actions' in the common dict, 'actions' and 'check' in the left
317
 
        and right dicts use names that map to methods in the test classes. Some
318
 
        prefixes are added to these names to get the correspong methods (see
319
 
        _get_actions() and _get_check()). The motivation here is to avoid
320
 
        collisions in the class namespace.
321
 
        """
322
 
        # Only concrete classes return actual scenarios
323
 
        return []
 
276
    scenarios = []
 
277
    """The scenario list for the conflict type defined by the class.
 
278
 
 
279
    Each scenario is of the form:
 
280
    (common, (left_name, left_dict), (right_name, right_dict))
 
281
 
 
282
    * common is a dict
 
283
 
 
284
    * left_name and right_name are the scenario names that will be combined
 
285
 
 
286
    * left_dict and right_dict are the attributes specific to each half of
 
287
      the scenario. They should include at least 'actions' and 'check' and
 
288
      will be available as '_this' and '_other' test instance attributes.
 
289
 
 
290
    Daughters classes are free to add their specific attributes as they see
 
291
    fit in any of the three dicts.
 
292
 
 
293
    This is a class method so that load_tests can find it.
 
294
 
 
295
    '_base_actions' in the common dict, 'actions' and 'check' in the left
 
296
    and right dicts use names that map to methods in the test classes. Some
 
297
    prefixes are added to these names to get the correspong methods (see
 
298
    _get_actions() and _get_check()). The motivation here is to avoid
 
299
    collisions in the class namespace.
 
300
    """
324
301
 
325
302
    def setUp(self):
326
303
        super(TestParametrizedResolveConflicts, self).setUp()
388
365
        check_other()
389
366
 
390
367
 
 
368
class TestResolveTextConflicts(TestParametrizedResolveConflicts):
 
369
 
 
370
    _conflict_type = conflicts.TextConflict
 
371
 
 
372
    # Set by the scenarios
 
373
    # path and file-id for the file involved in the conflict
 
374
    _path = None
 
375
    _file_id = None
 
376
 
 
377
    scenarios = mirror_scenarios(
 
378
        [
 
379
            # File modified/deleted
 
380
            (dict(_base_actions='create_file',
 
381
                  _path='file', _file_id='file-id'),
 
382
             ('filed_modified_A',
 
383
              dict(actions='modify_file_A', check='file_has_content_A')),
 
384
             ('file_modified_B',
 
385
              dict(actions='modify_file_B', check='file_has_content_B')),),
 
386
            ])
 
387
 
 
388
    def do_create_file(self):
 
389
        return [('add', ('file', 'file-id', 'file', 'trunk content\n'))]
 
390
 
 
391
    def do_modify_file_A(self):
 
392
        return [('modify', ('file-id', 'trunk content\nfeature A\n'))]
 
393
 
 
394
    def do_modify_file_B(self):
 
395
        return [('modify', ('file-id', 'trunk content\nfeature B\n'))]
 
396
 
 
397
    def check_file_has_content_A(self):
 
398
        self.assertFileEqual('trunk content\nfeature A\n', 'branch/file')
 
399
 
 
400
    def check_file_has_content_B(self):
 
401
        self.assertFileEqual('trunk content\nfeature B\n', 'branch/file')
 
402
 
 
403
    def _get_resolve_path_arg(self, wt, action):
 
404
        return self._path
 
405
 
 
406
    def assertTextConflict(self, wt, c):
 
407
        self.assertEqual(self._file_id, c.file_id)
 
408
        self.assertEqual(self._path, c.path)
 
409
    _assert_conflict = assertTextConflict
 
410
 
 
411
 
391
412
class TestResolveContentsConflict(TestParametrizedResolveConflicts):
392
413
 
393
 
    _conflict_type = conflicts.ContentsConflict,
 
414
    _conflict_type = conflicts.ContentsConflict
394
415
 
395
 
    # Set by load_tests from scenarios()
 
416
    # Set by the scenarios
396
417
    # path and file-id for the file involved in the conflict
397
418
    _path = None
398
419
    _file_id = None
399
420
 
400
 
    @staticmethod
401
 
    def scenarios():
402
 
        base_scenarios = [
 
421
    scenarios = mirror_scenarios(
 
422
        [
403
423
            # File modified/deleted
404
424
            (dict(_base_actions='create_file',
405
425
                  _path='file', _file_id='file-id'),
407
427
              dict(actions='modify_file', check='file_has_more_content')),
408
428
             ('file_deleted',
409
429
              dict(actions='delete_file', check='file_doesnt_exist')),),
410
 
            ]
411
 
        return mirror_scenarios(base_scenarios)
 
430
            # File modified/deleted in dir
 
431
            (dict(_base_actions='create_file_in_dir',
 
432
                  _path='dir/file', _file_id='file-id'),
 
433
             ('file_modified_in_dir',
 
434
              dict(actions='modify_file_in_dir',
 
435
                   check='file_in_dir_has_more_content')),
 
436
             ('file_deleted_in_dir',
 
437
              dict(actions='delete_file',
 
438
                   check='file_in_dir_doesnt_exist')),),
 
439
            ])
412
440
 
413
441
    def do_create_file(self):
414
442
        return [('add', ('file', 'file-id', 'file', 'trunk content\n'))]
425
453
    def check_file_doesnt_exist(self):
426
454
        self.failIfExists('branch/file')
427
455
 
 
456
    def do_create_file_in_dir(self):
 
457
        return [('add', ('dir', 'dir-id', 'directory', '')),
 
458
                ('add', ('dir/file', 'file-id', 'file', 'trunk content\n'))]
 
459
 
 
460
    def do_modify_file_in_dir(self):
 
461
        return [('modify', ('file-id', 'trunk content\nmore content\n'))]
 
462
 
 
463
    def check_file_in_dir_has_more_content(self):
 
464
        self.assertFileEqual('trunk content\nmore content\n', 'branch/dir/file')
 
465
 
 
466
    def check_file_in_dir_doesnt_exist(self):
 
467
        self.failIfExists('branch/dir/file')
 
468
 
428
469
    def _get_resolve_path_arg(self, wt, action):
429
470
        return self._path
430
471
 
436
477
 
437
478
class TestResolvePathConflict(TestParametrizedResolveConflicts):
438
479
 
439
 
    _conflict_type = conflicts.PathConflict,
 
480
    _conflict_type = conflicts.PathConflict
440
481
 
441
482
    def do_nothing(self):
442
483
        return []
443
484
 
444
 
    @staticmethod
445
 
    def scenarios():
446
 
        # Each side dict additionally defines:
447
 
        # - path path involved (can be '<deleted>')
448
 
        # - file-id involved
449
 
        base_scenarios = [
 
485
    # Each side dict additionally defines:
 
486
    # - path path involved (can be '<deleted>')
 
487
    # - file-id involved
 
488
    scenarios = mirror_scenarios(
 
489
        [
450
490
            # File renamed/deleted
451
491
            (dict(_base_actions='create_file'),
452
492
             ('file_renamed',
457
497
                   # PathConflicts deletion handling requires a special
458
498
                   # hard-coded value
459
499
                   path='<deleted>', file_id='file-id')),),
 
500
            # File renamed/deleted in dir
 
501
            (dict(_base_actions='create_file_in_dir'),
 
502
             ('file_renamed_in_dir',
 
503
              dict(actions='rename_file_in_dir', check='file_in_dir_renamed',
 
504
                   path='dir/new-file', file_id='file-id')),
 
505
             ('file_deleted',
 
506
              dict(actions='delete_file', check='file_in_dir_doesnt_exist',
 
507
                   # PathConflicts deletion handling requires a special
 
508
                   # hard-coded value
 
509
                   path='<deleted>', file_id='file-id')),),
460
510
            # File renamed/renamed differently
461
511
            (dict(_base_actions='create_file'),
462
512
             ('file_renamed',
483
533
             ('dir_renamed2',
484
534
              dict(actions='rename_dir2', check='dir_renamed2',
485
535
                   path='new-dir2', file_id='dir-id')),),
486
 
        ]
487
 
        return mirror_scenarios(base_scenarios)
 
536
            ])
488
537
 
489
538
    def do_create_file(self):
490
539
        return [('add', ('file', 'file-id', 'file', 'trunk content\n'))]
532
581
    def check_dir_doesnt_exist(self):
533
582
        self.failIfExists('branch/dir')
534
583
 
 
584
    def do_create_file_in_dir(self):
 
585
        return [('add', ('dir', 'dir-id', 'directory', '')),
 
586
                ('add', ('dir/file', 'file-id', 'file', 'trunk content\n'))]
 
587
 
 
588
    def do_rename_file_in_dir(self):
 
589
        return [('rename', ('dir/file', 'dir/new-file'))]
 
590
 
 
591
    def check_file_in_dir_renamed(self):
 
592
        self.failIfExists('branch/dir/file')
 
593
        self.failUnlessExists('branch/dir/new-file')
 
594
 
 
595
    def check_file_in_dir_doesnt_exist(self):
 
596
        self.failIfExists('branch/dir/file')
 
597
 
535
598
    def _get_resolve_path_arg(self, wt, action):
536
599
        tpath = self._this['path']
537
600
        opath = self._other['path']
568
631
 
569
632
class TestResolveDuplicateEntry(TestParametrizedResolveConflicts):
570
633
 
571
 
    _conflict_type = conflicts.DuplicateEntry,
 
634
    _conflict_type = conflicts.DuplicateEntry
572
635
 
573
 
    @staticmethod
574
 
    def scenarios():
575
 
        # Each side dict additionally defines:
576
 
        # - path involved
577
 
        # - file-id involved
578
 
        base_scenarios = [
 
636
    scenarios = mirror_scenarios(
 
637
        [
579
638
            # File created with different file-ids
580
639
            (dict(_base_actions='nothing'),
581
640
             ('filea_created',
584
643
             ('fileb_created',
585
644
              dict(actions='create_file_b', check='file_content_b',
586
645
                   path='file', file_id='file-b-id')),),
587
 
            ]
588
 
        return mirror_scenarios(base_scenarios)
 
646
            ])
589
647
 
590
648
    def do_nothing(self):
591
649
        return []
625
683
    # tests MissingParent resolution :-/
626
684
    preamble = """
627
685
$ bzr init trunk
 
686
...
628
687
$ cd trunk
629
688
$ mkdir dir
630
 
$ bzr add dir
631
 
$ bzr commit -m 'Create trunk'
632
 
 
 
689
$ bzr add -q dir
 
690
$ bzr commit -m 'Create trunk' -q
633
691
$ echo 'trunk content' >dir/file
634
 
$ bzr add dir/file
635
 
$ bzr commit -m 'Add dir/file in trunk'
636
 
 
637
 
$ bzr branch . -r 1 ../branch
 
692
$ bzr add -q dir/file
 
693
$ bzr commit -q -m 'Add dir/file in trunk'
 
694
$ bzr branch -q . -r 1 ../branch
638
695
$ cd ../branch
639
 
$ bzr rm dir
640
 
$ bzr commit -m 'Remove dir in branch'
641
 
 
 
696
$ bzr rm dir -q
 
697
$ bzr commit -q -m 'Remove dir in branch'
642
698
$ bzr merge ../trunk
643
699
2>+N  dir/
644
700
2>+N  dir/file
649
705
 
650
706
    def test_take_this(self):
651
707
        self.run_script("""
652
 
$ bzr rm dir  --force
 
708
$ bzr rm -q dir  --force
653
709
$ bzr resolve dir
654
 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 
710
2>2 conflict(s) resolved, 0 remaining
 
711
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
655
712
""")
656
713
 
657
714
    def test_take_other(self):
658
715
        self.run_script("""
659
716
$ bzr resolve dir
660
 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 
717
2>2 conflict(s) resolved, 0 remaining
 
718
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
661
719
""")
662
720
 
663
721
 
665
723
 
666
724
    preamble = """
667
725
$ bzr init trunk
 
726
...
668
727
$ cd trunk
669
728
$ mkdir dir
670
729
$ echo 'trunk content' >dir/file
671
 
$ bzr add
672
 
$ bzr commit -m 'Create trunk'
673
 
 
 
730
$ bzr add -q
 
731
$ bzr commit -m 'Create trunk' -q
674
732
$ echo 'trunk content' >dir/file2
675
 
$ bzr add dir/file2
676
 
$ bzr commit -m 'Add dir/file2 in branch'
677
 
 
678
 
$ bzr branch . -r 1 ../branch
 
733
$ bzr add -q dir/file2
 
734
$ bzr commit -q -m 'Add dir/file2 in branch'
 
735
$ bzr branch -q . -r 1 ../branch
679
736
$ cd ../branch
680
 
$ bzr rm dir/file --force
681
 
$ bzr rm dir
682
 
$ bzr commit -m 'Remove dir/file'
683
 
 
 
737
$ bzr rm -q dir/file --force
 
738
$ bzr rm -q dir
 
739
$ bzr commit -q -m 'Remove dir/file'
684
740
$ bzr merge ../trunk
685
741
2>+N  dir/
686
742
2>+N  dir/file2
692
748
    def test_keep_them_all(self):
693
749
        self.run_script("""
694
750
$ bzr resolve dir
695
 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 
751
2>2 conflict(s) resolved, 0 remaining
 
752
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
696
753
""")
697
754
 
698
755
    def test_adopt_child(self):
699
756
        self.run_script("""
700
 
$ bzr mv dir/file2 file2
701
 
$ bzr rm dir --force
 
757
$ bzr mv -q dir/file2 file2
 
758
$ bzr rm -q dir --force
702
759
$ bzr resolve dir
703
 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 
760
2>2 conflict(s) resolved, 0 remaining
 
761
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
704
762
""")
705
763
 
706
764
    def test_kill_them_all(self):
707
765
        self.run_script("""
708
 
$ bzr rm dir --force
 
766
$ bzr rm -q dir --force
709
767
$ bzr resolve dir
710
 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 
768
2>2 conflict(s) resolved, 0 remaining
 
769
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
711
770
""")
712
771
 
713
772
    def test_resolve_taking_this(self):
714
773
        self.run_script("""
715
774
$ bzr resolve --take-this dir
716
 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 
775
2>...
 
776
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
717
777
""")
718
778
 
719
779
    def test_resolve_taking_other(self):
720
780
        self.run_script("""
721
781
$ bzr resolve --take-other dir
722
 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 
782
2>...
 
783
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
723
784
""")
724
785
 
725
786
 
727
788
 
728
789
    preamble = """
729
790
$ bzr init trunk
 
791
...
730
792
$ cd trunk
731
793
$ mkdir dir
732
794
$ echo 'trunk content' >dir/file
733
 
$ bzr add
734
 
$ bzr commit -m 'Create trunk'
735
 
 
736
 
$ bzr rm dir/file --force
737
 
$ bzr rm dir --force
738
 
$ bzr commit -m 'Remove dir/file'
739
 
 
740
 
$ bzr branch . -r 1 ../branch
 
795
$ bzr add -q
 
796
$ bzr commit -m 'Create trunk' -q
 
797
$ bzr rm -q dir/file --force
 
798
$ bzr rm -q dir --force
 
799
$ bzr commit -q -m 'Remove dir/file'
 
800
$ bzr branch -q . -r 1 ../branch
741
801
$ cd ../branch
742
802
$ echo 'branch content' >dir/file2
743
 
$ bzr add dir/file2
744
 
$ bzr commit -m 'Add dir/file2 in branch'
745
 
 
 
803
$ bzr add -q dir/file2
 
804
$ bzr commit -q -m 'Add dir/file2 in branch'
746
805
$ bzr merge ../trunk
747
806
2>-D  dir/file
748
807
2>Conflict: can't delete dir because it is not empty.  Not deleting.
753
812
    def test_keep_them_all(self):
754
813
        self.run_script("""
755
814
$ bzr resolve dir
756
 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 
815
2>2 conflict(s) resolved, 0 remaining
 
816
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
757
817
""")
758
818
 
759
819
    def test_adopt_child(self):
760
820
        self.run_script("""
761
 
$ bzr mv dir/file2 file2
762
 
$ bzr rm dir --force
 
821
$ bzr mv -q dir/file2 file2
 
822
$ bzr rm -q dir --force
763
823
$ bzr resolve dir
764
 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 
824
2>2 conflict(s) resolved, 0 remaining
 
825
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
765
826
""")
766
827
 
767
828
    def test_kill_them_all(self):
768
829
        self.run_script("""
769
 
$ bzr rm dir --force
 
830
$ bzr rm -q dir --force
770
831
$ bzr resolve dir
771
 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 
832
2>2 conflict(s) resolved, 0 remaining
 
833
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
772
834
""")
773
835
 
774
836
    def test_resolve_taking_this(self):
775
837
        self.run_script("""
776
838
$ bzr resolve --take-this dir
777
 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 
839
2>2 conflict(s) resolved, 0 remaining
 
840
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
778
841
""")
779
842
 
780
843
    def test_resolve_taking_other(self):
781
844
        self.run_script("""
782
845
$ bzr resolve --take-other dir
783
 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 
846
2>deleted dir/file2
 
847
2>deleted dir
 
848
2>2 conflict(s) resolved, 0 remaining
 
849
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
784
850
""")
785
851
 
786
852
 
787
853
class TestResolveParentLoop(TestParametrizedResolveConflicts):
788
854
 
789
 
    _conflict_type = conflicts.ParentLoop,
 
855
    _conflict_type = conflicts.ParentLoop
790
856
 
791
857
    _this_args = None
792
858
    _other_args = None
793
859
 
794
 
    @staticmethod
795
 
    def scenarios():
796
 
        # Each side dict additionally defines:
797
 
        # - dir_id: the directory being moved
798
 
        # - target_id: The target directory
799
 
        # - xfail: whether the test is expected to fail if the action is
800
 
        #     involved as 'other'
801
 
        base_scenarios = [
 
860
    # Each side dict additionally defines:
 
861
    # - dir_id: the directory being moved
 
862
    # - target_id: The target directory
 
863
    # - xfail: whether the test is expected to fail if the action is
 
864
    #   involved as 'other'
 
865
    scenarios = mirror_scenarios(
 
866
        [
802
867
            # Dirs moved into each other
803
868
            (dict(_base_actions='create_dir1_dir2'),
804
869
             ('dir1_into_dir2',
815
880
             ('dir3_into_dir2',
816
881
              dict(actions='move_dir3_into_dir2', check='dir3_4_moved',
817
882
                   dir_id='dir3-id', target_id='dir2-id', xfail=True))),
818
 
            ]
819
 
        return mirror_scenarios(base_scenarios)
 
883
            ])
820
884
 
821
885
    def do_create_dir1_dir2(self):
822
886
        return [('add', ('dir1', 'dir1-id', 'directory', '')),
882
946
 
883
947
    preamble = """
884
948
$ bzr init trunk
 
949
...
885
950
$ cd trunk
886
951
$ bzr mkdir foo
887
 
$ bzr commit -m 'Create trunk'
 
952
...
 
953
$ bzr commit -m 'Create trunk' -q
888
954
$ echo "Boing" >foo/bar
889
 
$ bzr add foo/bar
890
 
$ bzr commit -m 'Add foo/bar'
891
 
 
892
 
$ bzr branch . -r 1 ../branch
 
955
$ bzr add -q foo/bar
 
956
$ bzr commit -q -m 'Add foo/bar'
 
957
$ bzr branch -q . -r 1 ../branch
893
958
$ cd ../branch
894
959
$ rm -r foo
895
960
$ echo "Boo!" >foo
896
 
$ bzr commit -m 'foo is now a file'
897
 
 
 
961
$ bzr commit -q -m 'foo is now a file'
898
962
$ bzr merge ../trunk
899
963
2>+N  foo.new/bar
900
964
2>RK  foo => foo.new/
906
970
 
907
971
    def test_take_this(self):
908
972
        self.run_script("""
909
 
$ bzr rm foo.new --force
 
973
$ bzr rm -q foo.new --force
910
974
# FIXME: Isn't it weird that foo is now unkown even if foo.new has been put
911
975
# aside ? -- vila 090916
912
 
$ bzr add foo
 
976
$ bzr add -q foo
913
977
$ bzr resolve foo.new
914
 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 
978
2>1 conflict(s) resolved, 0 remaining
 
979
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
915
980
""")
916
981
 
917
982
    def test_take_other(self):
918
983
        self.run_script("""
919
 
$ bzr rm foo --force
920
 
$ bzr mv foo.new foo
 
984
$ bzr rm -q foo --force
 
985
$ bzr mv -q foo.new foo
921
986
$ bzr resolve foo
922
 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 
987
2>1 conflict(s) resolved, 0 remaining
 
988
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
923
989
""")
924
990
 
925
991
    def test_resolve_taking_this(self):
926
992
        self.run_script("""
927
993
$ bzr resolve --take-this foo.new
928
 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 
994
2>...
 
995
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
929
996
""")
930
997
 
931
998
    def test_resolve_taking_other(self):
932
999
        self.run_script("""
933
1000
$ bzr resolve --take-other foo.new
934
 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 
1001
2>...
 
1002
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
935
1003
""")
936
1004
 
937
1005
 
943
1011
        # conflict.
944
1012
        self.run_script("""
945
1013
$ bzr init trunk
 
1014
...
946
1015
$ cd trunk
947
1016
$ bzr mkdir foo
948
 
$ bzr commit -m 'Create trunk'
 
1017
...
 
1018
$ bzr commit -m 'Create trunk' -q
949
1019
$ rm -r foo
950
1020
$ echo "Boo!" >foo
951
 
$ bzr commit -m 'foo is now a file'
952
 
 
953
 
$ bzr branch . -r 1 ../branch
 
1021
$ bzr commit -m 'foo is now a file' -q
 
1022
$ bzr branch -q . -r 1 ../branch -q
954
1023
$ cd ../branch
955
1024
$ echo "Boing" >foo/bar
956
 
$ bzr add foo/bar
957
 
$ bzr commit -m 'Add foo/bar'
958
 
 
 
1025
$ bzr add -q foo/bar -q
 
1026
$ bzr commit -m 'Add foo/bar' -q
959
1027
$ bzr merge ../trunk
960
1028
2>bzr: ERROR: Tree transform is malformed [('unversioned executability', 'new-1')]
961
1029
""")