~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_conflicts.py

  • Committer: Vincent Ladeuil
  • Date: 2011-01-15 17:29:41 UTC
  • mfrom: (5050.62.2 2.2)
  • mto: (5609.2.3 2.3)
  • mto: This revision was merged to the branch mainline in revision 5615.
  • Revision ID: v.ladeuil+lp@free.fr-20110115172941-ukpq0aseczd5g0o7
Merge 2.2 into 2.3 including fix for bug #660935

Show diffs side-by-side

added added

removed removed

Lines of Context:
427
427
              dict(actions='modify_file', check='file_has_more_content')),
428
428
             ('file_deleted',
429
429
              dict(actions='delete_file', check='file_doesnt_exist')),),
 
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')),),
430
439
            ])
431
440
 
432
441
    def do_create_file(self):
444
453
    def check_file_doesnt_exist(self):
445
454
        self.failIfExists('branch/file')
446
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
 
447
469
    def _get_resolve_path_arg(self, wt, action):
448
470
        return self._path
449
471
 
475
497
                   # PathConflicts deletion handling requires a special
476
498
                   # hard-coded value
477
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')),),
478
510
            # File renamed/renamed differently
479
511
            (dict(_base_actions='create_file'),
480
512
             ('file_renamed',
549
581
    def check_dir_doesnt_exist(self):
550
582
        self.failIfExists('branch/dir')
551
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
 
552
598
    def _get_resolve_path_arg(self, wt, action):
553
599
        tpath = self._this['path']
554
600
        opath = self._other['path']
982
1028
2>bzr: ERROR: Tree transform is malformed [('unversioned executability', 'new-1')]
983
1029
""")
984
1030
 
 
1031
    def test_bug_660935(self):
 
1032
        self.run_script("""
 
1033
$ bzr init trunk
 
1034
Created a standalone tree (format: 2a)
 
1035
$ cd trunk
 
1036
$ mkdir src
 
1037
$ echo trunk > src/file
 
1038
$ bzr add
 
1039
adding src
 
1040
adding src/file
 
1041
$ bzr commit -m 'create file on trunk'
 
1042
2>Committing to: .../trunk/
 
1043
2>added src
 
1044
2>added src/file
 
1045
2>Committed revision 1.
 
1046
$ cd ..
 
1047
$ bzr branch trunk featureA
 
1048
2>Branched 1 revision(s).
 
1049
$ cd featureA
 
1050
$ echo featureA > src/file
 
1051
$ bzr commit -m 'modify file for featureA'
 
1052
2>Committing to: .../featureA/
 
1053
2>modified src/file
 
1054
2>Committed revision 2.
 
1055
$ cd ..
 
1056
$ cd trunk
 
1057
$ bzr rm src/file
 
1058
2>deleted src/file
 
1059
$ bzr commit -m 'Delete file'
 
1060
2>Committing to: .../trunk/
 
1061
2>deleted src/file
 
1062
2>Committed revision 2.
 
1063
$ cd ../featureA
 
1064
$ bzr merge ../trunk
 
1065
2>RM  src/file => src/file.THIS
 
1066
2>Contents conflict in src/file
 
1067
2>1 conflicts encountered.
 
1068
$ bzr conflicts
 
1069
Contents conflict in src/file
 
1070
$ bzr resolve --take-other
 
1071
""")
 
1072
 
985
1073
 
986
1074
class TestResolveActionOption(tests.TestCase):
987
1075