~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_conflicts.py

  • Committer: Andrew Bennetts
  • Date: 2011-02-25 08:45:27 UTC
  • mto: This revision was merged to the branch mainline in revision 5695.
  • Revision ID: andrew.bennetts@canonical.com-20110225084527-0ucp7p00d00hoqon
Add another test.

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,
 
25
    osutils,
26
26
    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
 
27
    )
 
28
from bzrlib.tests import (
 
29
    script,
 
30
    scenarios,
 
31
    )
 
32
 
 
33
 
 
34
load_tests = scenarios.load_tests_apply_scenarios
49
35
 
50
36
 
51
37
# TODO: Test commit with some added, and added-but-missing files
210
196
        self.run_script(self.preamble)
211
197
 
212
198
 
213
 
class TestResolveTextConflicts(TestResolveConflicts):
214
 
    # TBC
215
 
    pass
216
 
 
217
 
 
218
199
def mirror_scenarios(base_scenarios):
219
200
    """Return a list of mirrored scenarios.
220
201
 
293
274
    _this = None
294
275
    _other = None
295
276
 
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 []
 
277
    scenarios = []
 
278
    """The scenario list for the conflict type defined by the class.
 
279
 
 
280
    Each scenario is of the form:
 
281
    (common, (left_name, left_dict), (right_name, right_dict))
 
282
 
 
283
    * common is a dict
 
284
 
 
285
    * left_name and right_name are the scenario names that will be combined
 
286
 
 
287
    * left_dict and right_dict are the attributes specific to each half of
 
288
      the scenario. They should include at least 'actions' and 'check' and
 
289
      will be available as '_this' and '_other' test instance attributes.
 
290
 
 
291
    Daughters classes are free to add their specific attributes as they see
 
292
    fit in any of the three dicts.
 
293
 
 
294
    This is a class method so that load_tests can find it.
 
295
 
 
296
    '_base_actions' in the common dict, 'actions' and 'check' in the left
 
297
    and right dicts use names that map to methods in the test classes. Some
 
298
    prefixes are added to these names to get the correspong methods (see
 
299
    _get_actions() and _get_check()). The motivation here is to avoid
 
300
    collisions in the class namespace.
 
301
    """
324
302
 
325
303
    def setUp(self):
326
304
        super(TestParametrizedResolveConflicts, self).setUp()
388
366
        check_other()
389
367
 
390
368
 
 
369
class TestResolveTextConflicts(TestParametrizedResolveConflicts):
 
370
 
 
371
    _conflict_type = conflicts.TextConflict
 
372
 
 
373
    # Set by the scenarios
 
374
    # path and file-id for the file involved in the conflict
 
375
    _path = None
 
376
    _file_id = None
 
377
 
 
378
    scenarios = mirror_scenarios(
 
379
        [
 
380
            # File modified on both sides
 
381
            (dict(_base_actions='create_file',
 
382
                  _path='file', _file_id='file-id'),
 
383
             ('filed_modified_A',
 
384
              dict(actions='modify_file_A', check='file_has_content_A')),
 
385
             ('file_modified_B',
 
386
              dict(actions='modify_file_B', check='file_has_content_B')),),
 
387
            # File modified on both sides in dir
 
388
            (dict(_base_actions='create_file_in_dir',
 
389
                  _path='dir/file', _file_id='file-id'),
 
390
             ('filed_modified_A_in_dir',
 
391
              dict(actions='modify_file_A',
 
392
                   check='file_in_dir_has_content_A')),
 
393
             ('file_modified_B',
 
394
              dict(actions='modify_file_B',
 
395
                   check='file_in_dir_has_content_B')),),
 
396
            ])
 
397
 
 
398
    def do_create_file(self, path='file'):
 
399
        return [('add', (path, 'file-id', 'file', 'trunk content\n'))]
 
400
 
 
401
    def do_modify_file_A(self):
 
402
        return [('modify', ('file-id', 'trunk content\nfeature A\n'))]
 
403
 
 
404
    def do_modify_file_B(self):
 
405
        return [('modify', ('file-id', 'trunk content\nfeature B\n'))]
 
406
 
 
407
    def check_file_has_content_A(self, path='file'):
 
408
        self.assertFileEqual('trunk content\nfeature A\n',
 
409
                             osutils.pathjoin('branch', path))
 
410
 
 
411
    def check_file_has_content_B(self, path='file'):
 
412
        self.assertFileEqual('trunk content\nfeature B\n',
 
413
                             osutils.pathjoin('branch', path))
 
414
 
 
415
    def do_create_file_in_dir(self):
 
416
        return [('add', ('dir', 'dir-id', 'directory', '')),
 
417
            ] + self.do_create_file('dir/file')
 
418
 
 
419
    def check_file_in_dir_has_content_A(self):
 
420
        self.check_file_has_content_A('dir/file')
 
421
 
 
422
    def check_file_in_dir_has_content_B(self):
 
423
        self.check_file_has_content_B('dir/file')
 
424
 
 
425
    def _get_resolve_path_arg(self, wt, action):
 
426
        return self._path
 
427
 
 
428
    def assertTextConflict(self, wt, c):
 
429
        self.assertEqual(self._file_id, c.file_id)
 
430
        self.assertEqual(self._path, c.path)
 
431
    _assert_conflict = assertTextConflict
 
432
 
 
433
 
391
434
class TestResolveContentsConflict(TestParametrizedResolveConflicts):
392
435
 
393
 
    _conflict_type = conflicts.ContentsConflict,
 
436
    _conflict_type = conflicts.ContentsConflict
394
437
 
395
 
    # Set by load_tests from scenarios()
 
438
    # Set by the scenarios
396
439
    # path and file-id for the file involved in the conflict
397
440
    _path = None
398
441
    _file_id = None
399
442
 
400
 
    @staticmethod
401
 
    def scenarios():
402
 
        base_scenarios = [
 
443
    scenarios = mirror_scenarios(
 
444
        [
403
445
            # File modified/deleted
404
446
            (dict(_base_actions='create_file',
405
447
                  _path='file', _file_id='file-id'),
407
449
              dict(actions='modify_file', check='file_has_more_content')),
408
450
             ('file_deleted',
409
451
              dict(actions='delete_file', check='file_doesnt_exist')),),
410
 
            ]
411
 
        return mirror_scenarios(base_scenarios)
 
452
            # File modified/deleted in dir
 
453
            (dict(_base_actions='create_file_in_dir',
 
454
                  _path='dir/file', _file_id='file-id'),
 
455
             ('file_modified_in_dir',
 
456
              dict(actions='modify_file_in_dir',
 
457
                   check='file_in_dir_has_more_content')),
 
458
             ('file_deleted_in_dir',
 
459
              dict(actions='delete_file',
 
460
                   check='file_in_dir_doesnt_exist')),),
 
461
            ])
412
462
 
413
463
    def do_create_file(self):
414
464
        return [('add', ('file', 'file-id', 'file', 'trunk content\n'))]
425
475
    def check_file_doesnt_exist(self):
426
476
        self.failIfExists('branch/file')
427
477
 
 
478
    def do_create_file_in_dir(self):
 
479
        return [('add', ('dir', 'dir-id', 'directory', '')),
 
480
                ('add', ('dir/file', 'file-id', 'file', 'trunk content\n'))]
 
481
 
 
482
    def do_modify_file_in_dir(self):
 
483
        return [('modify', ('file-id', 'trunk content\nmore content\n'))]
 
484
 
 
485
    def check_file_in_dir_has_more_content(self):
 
486
        self.assertFileEqual('trunk content\nmore content\n', 'branch/dir/file')
 
487
 
 
488
    def check_file_in_dir_doesnt_exist(self):
 
489
        self.failIfExists('branch/dir/file')
 
490
 
428
491
    def _get_resolve_path_arg(self, wt, action):
429
492
        return self._path
430
493
 
436
499
 
437
500
class TestResolvePathConflict(TestParametrizedResolveConflicts):
438
501
 
439
 
    _conflict_type = conflicts.PathConflict,
 
502
    _conflict_type = conflicts.PathConflict
440
503
 
441
504
    def do_nothing(self):
442
505
        return []
443
506
 
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 = [
 
507
    # Each side dict additionally defines:
 
508
    # - path path involved (can be '<deleted>')
 
509
    # - file-id involved
 
510
    scenarios = mirror_scenarios(
 
511
        [
450
512
            # File renamed/deleted
451
513
            (dict(_base_actions='create_file'),
452
514
             ('file_renamed',
457
519
                   # PathConflicts deletion handling requires a special
458
520
                   # hard-coded value
459
521
                   path='<deleted>', file_id='file-id')),),
 
522
            # File renamed/deleted in dir
 
523
            (dict(_base_actions='create_file_in_dir'),
 
524
             ('file_renamed_in_dir',
 
525
              dict(actions='rename_file_in_dir', check='file_in_dir_renamed',
 
526
                   path='dir/new-file', file_id='file-id')),
 
527
             ('file_deleted',
 
528
              dict(actions='delete_file', check='file_in_dir_doesnt_exist',
 
529
                   # PathConflicts deletion handling requires a special
 
530
                   # hard-coded value
 
531
                   path='<deleted>', file_id='file-id')),),
460
532
            # File renamed/renamed differently
461
533
            (dict(_base_actions='create_file'),
462
534
             ('file_renamed',
483
555
             ('dir_renamed2',
484
556
              dict(actions='rename_dir2', check='dir_renamed2',
485
557
                   path='new-dir2', file_id='dir-id')),),
486
 
        ]
487
 
        return mirror_scenarios(base_scenarios)
 
558
            ])
488
559
 
489
560
    def do_create_file(self):
490
561
        return [('add', ('file', 'file-id', 'file', 'trunk content\n'))]
532
603
    def check_dir_doesnt_exist(self):
533
604
        self.failIfExists('branch/dir')
534
605
 
 
606
    def do_create_file_in_dir(self):
 
607
        return [('add', ('dir', 'dir-id', 'directory', '')),
 
608
                ('add', ('dir/file', 'file-id', 'file', 'trunk content\n'))]
 
609
 
 
610
    def do_rename_file_in_dir(self):
 
611
        return [('rename', ('dir/file', 'dir/new-file'))]
 
612
 
 
613
    def check_file_in_dir_renamed(self):
 
614
        self.failIfExists('branch/dir/file')
 
615
        self.failUnlessExists('branch/dir/new-file')
 
616
 
 
617
    def check_file_in_dir_doesnt_exist(self):
 
618
        self.failIfExists('branch/dir/file')
 
619
 
535
620
    def _get_resolve_path_arg(self, wt, action):
536
621
        tpath = self._this['path']
537
622
        opath = self._other['path']
568
653
 
569
654
class TestResolveDuplicateEntry(TestParametrizedResolveConflicts):
570
655
 
571
 
    _conflict_type = conflicts.DuplicateEntry,
 
656
    _conflict_type = conflicts.DuplicateEntry
572
657
 
573
 
    @staticmethod
574
 
    def scenarios():
575
 
        # Each side dict additionally defines:
576
 
        # - path involved
577
 
        # - file-id involved
578
 
        base_scenarios = [
 
658
    scenarios = mirror_scenarios(
 
659
        [
579
660
            # File created with different file-ids
580
661
            (dict(_base_actions='nothing'),
581
662
             ('filea_created',
584
665
             ('fileb_created',
585
666
              dict(actions='create_file_b', check='file_content_b',
586
667
                   path='file', file_id='file-b-id')),),
587
 
            ]
588
 
        return mirror_scenarios(base_scenarios)
 
668
            ])
589
669
 
590
670
    def do_nothing(self):
591
671
        return []
625
705
    # tests MissingParent resolution :-/
626
706
    preamble = """
627
707
$ bzr init trunk
 
708
...
628
709
$ cd trunk
629
710
$ mkdir dir
630
 
$ bzr add dir
631
 
$ bzr commit -m 'Create trunk'
632
 
 
 
711
$ bzr add -q dir
 
712
$ bzr commit -m 'Create trunk' -q
633
713
$ 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
 
714
$ bzr add -q dir/file
 
715
$ bzr commit -q -m 'Add dir/file in trunk'
 
716
$ bzr branch -q . -r 1 ../branch
638
717
$ cd ../branch
639
 
$ bzr rm dir
640
 
$ bzr commit -m 'Remove dir in branch'
641
 
 
 
718
$ bzr rm dir -q
 
719
$ bzr commit -q -m 'Remove dir in branch'
642
720
$ bzr merge ../trunk
643
721
2>+N  dir/
644
722
2>+N  dir/file
649
727
 
650
728
    def test_take_this(self):
651
729
        self.run_script("""
652
 
$ bzr rm dir  --force
 
730
$ bzr rm -q dir  --force
653
731
$ bzr resolve dir
654
 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 
732
2>2 conflict(s) resolved, 0 remaining
 
733
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
655
734
""")
656
735
 
657
736
    def test_take_other(self):
658
737
        self.run_script("""
659
738
$ bzr resolve dir
660
 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 
739
2>2 conflict(s) resolved, 0 remaining
 
740
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
661
741
""")
662
742
 
663
743
 
665
745
 
666
746
    preamble = """
667
747
$ bzr init trunk
 
748
...
668
749
$ cd trunk
669
750
$ mkdir dir
670
751
$ echo 'trunk content' >dir/file
671
 
$ bzr add
672
 
$ bzr commit -m 'Create trunk'
673
 
 
 
752
$ bzr add -q
 
753
$ bzr commit -m 'Create trunk' -q
674
754
$ 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
 
755
$ bzr add -q dir/file2
 
756
$ bzr commit -q -m 'Add dir/file2 in branch'
 
757
$ bzr branch -q . -r 1 ../branch
679
758
$ cd ../branch
680
 
$ bzr rm dir/file --force
681
 
$ bzr rm dir
682
 
$ bzr commit -m 'Remove dir/file'
683
 
 
 
759
$ bzr rm -q dir/file --force
 
760
$ bzr rm -q dir
 
761
$ bzr commit -q -m 'Remove dir/file'
684
762
$ bzr merge ../trunk
685
763
2>+N  dir/
686
764
2>+N  dir/file2
692
770
    def test_keep_them_all(self):
693
771
        self.run_script("""
694
772
$ bzr resolve dir
695
 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 
773
2>2 conflict(s) resolved, 0 remaining
 
774
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
696
775
""")
697
776
 
698
777
    def test_adopt_child(self):
699
778
        self.run_script("""
700
 
$ bzr mv dir/file2 file2
701
 
$ bzr rm dir --force
 
779
$ bzr mv -q dir/file2 file2
 
780
$ bzr rm -q dir --force
702
781
$ bzr resolve dir
703
 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 
782
2>2 conflict(s) resolved, 0 remaining
 
783
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
704
784
""")
705
785
 
706
786
    def test_kill_them_all(self):
707
787
        self.run_script("""
708
 
$ bzr rm dir --force
 
788
$ bzr rm -q dir --force
709
789
$ bzr resolve dir
710
 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 
790
2>2 conflict(s) resolved, 0 remaining
 
791
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
711
792
""")
712
793
 
713
794
    def test_resolve_taking_this(self):
714
795
        self.run_script("""
715
796
$ bzr resolve --take-this dir
716
 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 
797
2>...
 
798
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
717
799
""")
718
800
 
719
801
    def test_resolve_taking_other(self):
720
802
        self.run_script("""
721
803
$ bzr resolve --take-other dir
722
 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 
804
2>...
 
805
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
723
806
""")
724
807
 
725
808
 
727
810
 
728
811
    preamble = """
729
812
$ bzr init trunk
 
813
...
730
814
$ cd trunk
731
815
$ mkdir dir
732
816
$ 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
 
817
$ bzr add -q
 
818
$ bzr commit -m 'Create trunk' -q
 
819
$ bzr rm -q dir/file --force
 
820
$ bzr rm -q dir --force
 
821
$ bzr commit -q -m 'Remove dir/file'
 
822
$ bzr branch -q . -r 1 ../branch
741
823
$ cd ../branch
742
824
$ echo 'branch content' >dir/file2
743
 
$ bzr add dir/file2
744
 
$ bzr commit -m 'Add dir/file2 in branch'
745
 
 
 
825
$ bzr add -q dir/file2
 
826
$ bzr commit -q -m 'Add dir/file2 in branch'
746
827
$ bzr merge ../trunk
747
828
2>-D  dir/file
748
829
2>Conflict: can't delete dir because it is not empty.  Not deleting.
753
834
    def test_keep_them_all(self):
754
835
        self.run_script("""
755
836
$ bzr resolve dir
756
 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 
837
2>2 conflict(s) resolved, 0 remaining
 
838
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
757
839
""")
758
840
 
759
841
    def test_adopt_child(self):
760
842
        self.run_script("""
761
 
$ bzr mv dir/file2 file2
762
 
$ bzr rm dir --force
 
843
$ bzr mv -q dir/file2 file2
 
844
$ bzr rm -q dir --force
763
845
$ bzr resolve dir
764
 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 
846
2>2 conflict(s) resolved, 0 remaining
 
847
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
765
848
""")
766
849
 
767
850
    def test_kill_them_all(self):
768
851
        self.run_script("""
769
 
$ bzr rm dir --force
 
852
$ bzr rm -q dir --force
770
853
$ bzr resolve dir
771
 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 
854
2>2 conflict(s) resolved, 0 remaining
 
855
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
772
856
""")
773
857
 
774
858
    def test_resolve_taking_this(self):
775
859
        self.run_script("""
776
860
$ bzr resolve --take-this dir
777
 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 
861
2>2 conflict(s) resolved, 0 remaining
 
862
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
778
863
""")
779
864
 
780
865
    def test_resolve_taking_other(self):
781
866
        self.run_script("""
782
867
$ bzr resolve --take-other dir
783
 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 
868
2>deleted dir/file2
 
869
2>deleted dir
 
870
2>2 conflict(s) resolved, 0 remaining
 
871
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
784
872
""")
785
873
 
786
874
 
787
875
class TestResolveParentLoop(TestParametrizedResolveConflicts):
788
876
 
789
 
    _conflict_type = conflicts.ParentLoop,
 
877
    _conflict_type = conflicts.ParentLoop
790
878
 
791
879
    _this_args = None
792
880
    _other_args = None
793
881
 
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 = [
 
882
    # Each side dict additionally defines:
 
883
    # - dir_id: the directory being moved
 
884
    # - target_id: The target directory
 
885
    # - xfail: whether the test is expected to fail if the action is
 
886
    #   involved as 'other'
 
887
    scenarios = mirror_scenarios(
 
888
        [
802
889
            # Dirs moved into each other
803
890
            (dict(_base_actions='create_dir1_dir2'),
804
891
             ('dir1_into_dir2',
815
902
             ('dir3_into_dir2',
816
903
              dict(actions='move_dir3_into_dir2', check='dir3_4_moved',
817
904
                   dir_id='dir3-id', target_id='dir2-id', xfail=True))),
818
 
            ]
819
 
        return mirror_scenarios(base_scenarios)
 
905
            ])
820
906
 
821
907
    def do_create_dir1_dir2(self):
822
908
        return [('add', ('dir1', 'dir1-id', 'directory', '')),
882
968
 
883
969
    preamble = """
884
970
$ bzr init trunk
 
971
...
885
972
$ cd trunk
886
973
$ bzr mkdir foo
887
 
$ bzr commit -m 'Create trunk'
 
974
...
 
975
$ bzr commit -m 'Create trunk' -q
888
976
$ echo "Boing" >foo/bar
889
 
$ bzr add foo/bar
890
 
$ bzr commit -m 'Add foo/bar'
891
 
 
892
 
$ bzr branch . -r 1 ../branch
 
977
$ bzr add -q foo/bar
 
978
$ bzr commit -q -m 'Add foo/bar'
 
979
$ bzr branch -q . -r 1 ../branch
893
980
$ cd ../branch
894
981
$ rm -r foo
895
982
$ echo "Boo!" >foo
896
 
$ bzr commit -m 'foo is now a file'
897
 
 
 
983
$ bzr commit -q -m 'foo is now a file'
898
984
$ bzr merge ../trunk
899
985
2>+N  foo.new/bar
900
986
2>RK  foo => foo.new/
906
992
 
907
993
    def test_take_this(self):
908
994
        self.run_script("""
909
 
$ bzr rm foo.new --force
 
995
$ bzr rm -q foo.new --force
910
996
# FIXME: Isn't it weird that foo is now unkown even if foo.new has been put
911
997
# aside ? -- vila 090916
912
 
$ bzr add foo
 
998
$ bzr add -q foo
913
999
$ bzr resolve foo.new
914
 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 
1000
2>1 conflict(s) resolved, 0 remaining
 
1001
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
915
1002
""")
916
1003
 
917
1004
    def test_take_other(self):
918
1005
        self.run_script("""
919
 
$ bzr rm foo --force
920
 
$ bzr mv foo.new foo
 
1006
$ bzr rm -q foo --force
 
1007
$ bzr mv -q foo.new foo
921
1008
$ bzr resolve foo
922
 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 
1009
2>1 conflict(s) resolved, 0 remaining
 
1010
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
923
1011
""")
924
1012
 
925
1013
    def test_resolve_taking_this(self):
926
1014
        self.run_script("""
927
1015
$ bzr resolve --take-this foo.new
928
 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 
1016
2>...
 
1017
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
929
1018
""")
930
1019
 
931
1020
    def test_resolve_taking_other(self):
932
1021
        self.run_script("""
933
1022
$ bzr resolve --take-other foo.new
934
 
$ bzr commit --strict -m 'No more conflicts nor unknown files'
 
1023
2>...
 
1024
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
935
1025
""")
936
1026
 
937
1027
 
943
1033
        # conflict.
944
1034
        self.run_script("""
945
1035
$ bzr init trunk
 
1036
...
946
1037
$ cd trunk
947
1038
$ bzr mkdir foo
948
 
$ bzr commit -m 'Create trunk'
 
1039
...
 
1040
$ bzr commit -m 'Create trunk' -q
949
1041
$ rm -r foo
950
1042
$ echo "Boo!" >foo
951
 
$ bzr commit -m 'foo is now a file'
952
 
 
953
 
$ bzr branch . -r 1 ../branch
 
1043
$ bzr commit -m 'foo is now a file' -q
 
1044
$ bzr branch -q . -r 1 ../branch -q
954
1045
$ cd ../branch
955
1046
$ echo "Boing" >foo/bar
956
 
$ bzr add foo/bar
957
 
$ bzr commit -m 'Add foo/bar'
958
 
 
 
1047
$ bzr add -q foo/bar -q
 
1048
$ bzr commit -m 'Add foo/bar' -q
959
1049
$ bzr merge ../trunk
960
1050
2>bzr: ERROR: Tree transform is malformed [('unversioned executability', 'new-1')]
961
1051
""")