~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-02-08 13:56:49 UTC
  • mfrom: (5609.2.12 2.3)
  • mto: This revision was merged to the branch mainline in revision 5652.
  • Revision ID: v.ladeuil+lp@free.fr-20110208135649-5w2ifp3o040h83f3
Merge 2.3 into trunk including fixes for bug #715058 and bug #713258

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
    conflicts,
23
23
    errors,
24
24
    option,
 
25
    osutils,
25
26
    tests,
26
27
    )
27
28
from bzrlib.tests import (
376
377
 
377
378
    scenarios = mirror_scenarios(
378
379
        [
379
 
            # File modified/deleted
 
380
            # File modified on both sides
380
381
            (dict(_base_actions='create_file',
381
382
                  _path='file', _file_id='file-id'),
382
383
             ('filed_modified_A',
383
384
              dict(actions='modify_file_A', check='file_has_content_A')),
384
385
             ('file_modified_B',
385
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')),),
386
396
            ])
387
397
 
388
 
    def do_create_file(self):
389
 
        return [('add', ('file', 'file-id', 'file', 'trunk content\n'))]
 
398
    def do_create_file(self, path='file'):
 
399
        return [('add', (path, 'file-id', 'file', 'trunk content\n'))]
390
400
 
391
401
    def do_modify_file_A(self):
392
402
        return [('modify', ('file-id', 'trunk content\nfeature A\n'))]
394
404
    def do_modify_file_B(self):
395
405
        return [('modify', ('file-id', 'trunk content\nfeature B\n'))]
396
406
 
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')
 
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')
402
424
 
403
425
    def _get_resolve_path_arg(self, wt, action):
404
426
        return self._path