~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_conflicts.py

  • Committer: Patch Queue Manager
  • Date: 2015-12-17 18:39:00 UTC
  • mfrom: (6606.1.2 fix-float)
  • Revision ID: pqm@pqm.ubuntu.com-20151217183900-0719du2uv1kwu3lc
(vila) Inline testtools private method to fix an issue in xenial (the
 private implementation has changed in an backward incompatible way).
 (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
import os
19
19
 
20
20
from bzrlib import (
21
 
    bzrdir,
22
21
    conflicts,
23
22
    errors,
24
23
    option,
677
676
             ('fileb_created',
678
677
              dict(actions='create_file_b', check='file_content_b',
679
678
                   path='file', file_id='file-b-id')),),
 
679
            # File created with different file-ids but deleted on one side
 
680
            (dict(_base_actions='create_file_a'),
 
681
             ('filea_replaced',
 
682
              dict(actions='replace_file_a_by_b', check='file_content_b',
 
683
                   path='file', file_id='file-b-id')),
 
684
             ('filea_modified',
 
685
              dict(actions='modify_file_a', check='file_new_content',
 
686
                   path='file', file_id='file-a-id')),),
680
687
            ])
681
688
 
682
689
    def do_nothing(self):
694
701
    def check_file_content_b(self):
695
702
        self.assertFileEqual('file b content\n', 'branch/file')
696
703
 
 
704
    def do_replace_file_a_by_b(self):
 
705
        return [('unversion', 'file-a-id'),
 
706
                ('add', ('file', 'file-b-id', 'file', 'file b content\n'))]
 
707
 
 
708
    def do_modify_file_a(self):
 
709
        return [('modify', ('file-a-id', 'new content\n'))]
 
710
 
 
711
    def check_file_new_content(self):
 
712
        self.assertFileEqual('new content\n', 'branch/file')
 
713
 
697
714
    def _get_resolve_path_arg(self, wt, action):
698
715
        return self._this['path']
699
716
 
739
756
 
740
757
    def test_take_this(self):
741
758
        self.run_script("""
742
 
$ bzr rm -q dir  --force
 
759
$ bzr rm -q dir --no-backup
743
760
$ bzr resolve dir
744
761
2>2 conflicts resolved, 0 remaining
745
762
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
768
785
$ bzr commit -q -m 'Add dir/file2 in branch'
769
786
$ bzr branch -q . -r 1 ../branch
770
787
$ cd ../branch
771
 
$ bzr rm -q dir/file --force
 
788
$ bzr rm -q dir/file --no-backup
772
789
$ bzr rm -q dir
773
790
$ bzr commit -q -m 'Remove dir/file'
774
791
$ bzr merge ../trunk
789
806
    def test_adopt_child(self):
790
807
        self.run_script("""
791
808
$ bzr mv -q dir/file2 file2
792
 
$ bzr rm -q dir --force
 
809
$ bzr rm -q dir --no-backup
793
810
$ bzr resolve dir
794
811
2>2 conflicts resolved, 0 remaining
795
812
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
797
814
 
798
815
    def test_kill_them_all(self):
799
816
        self.run_script("""
800
 
$ bzr rm -q dir --force
 
817
$ bzr rm -q dir --no-backup
801
818
$ bzr resolve dir
802
819
2>2 conflicts resolved, 0 remaining
803
820
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
828
845
$ echo 'trunk content' >dir/file
829
846
$ bzr add -q
830
847
$ bzr commit -m 'Create trunk' -q
831
 
$ bzr rm -q dir/file --force
832
 
$ bzr rm -q dir --force
 
848
$ bzr rm -q dir/file --no-backup
 
849
$ bzr rm -q dir --no-backup
833
850
$ bzr commit -q -m 'Remove dir/file'
834
851
$ bzr branch -q . -r 1 ../branch
835
852
$ cd ../branch
853
870
    def test_adopt_child(self):
854
871
        self.run_script("""
855
872
$ bzr mv -q dir/file2 file2
856
 
$ bzr rm -q dir --force
 
873
$ bzr rm -q dir --no-backup
857
874
$ bzr resolve dir
858
875
2>2 conflicts resolved, 0 remaining
859
876
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
861
878
 
862
879
    def test_kill_them_all(self):
863
880
        self.run_script("""
864
 
$ bzr rm -q dir --force
 
881
$ bzr rm -q dir --no-backup
865
882
$ bzr resolve dir
866
883
2>2 conflicts resolved, 0 remaining
867
884
$ bzr commit -q --strict -m 'No more conflicts nor unknown files'
1004
1021
 
1005
1022
    def test_take_this(self):
1006
1023
        self.run_script("""
1007
 
$ bzr rm -q foo.new --force
 
1024
$ bzr rm -q foo.new --no-backup
1008
1025
# FIXME: Isn't it weird that foo is now unkown even if foo.new has been put
1009
1026
# aside ? -- vila 090916
1010
1027
$ bzr add -q foo
1015
1032
 
1016
1033
    def test_take_other(self):
1017
1034
        self.run_script("""
1018
 
$ bzr rm -q foo --force
 
1035
$ bzr rm -q foo --no-backup
1019
1036
$ bzr mv -q foo.new foo
1020
1037
$ bzr resolve foo
1021
1038
2>1 conflict resolved, 0 remaining
1043
1060
        # This is nearly like TestResolveNonDirectoryParent but with branch and
1044
1061
        # trunk switched. As such it should certainly produce the same
1045
1062
        # conflict.
1046
 
        self.run_script("""
 
1063
        self.assertRaises(errors.MalformedTransform,
 
1064
                          self.run_script,"""
1047
1065
$ bzr init trunk
1048
1066
...
1049
1067
$ cd trunk