/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: Andrew Bennetts
  • Date: 2011-02-07 04:14:29 UTC
  • mfrom: (5535.4.26 fetch-all-tags-309682)
  • mto: This revision was merged to the branch mainline in revision 5648.
  • Revision ID: andrew.bennetts@canonical.com-20110207041429-3kc1blj34rvvxod9
Merge fetch-all-tags-309682.

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
26
    )
29
27
from bzrlib.tests import (
30
28
    script,
429
427
              dict(actions='modify_file', check='file_has_more_content')),
430
428
             ('file_deleted',
431
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')),),
432
439
            ])
433
440
 
434
441
    def do_create_file(self):
446
453
    def check_file_doesnt_exist(self):
447
454
        self.failIfExists('branch/file')
448
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
 
449
469
    def _get_resolve_path_arg(self, wt, action):
450
470
        return self._path
451
471
 
477
497
                   # PathConflicts deletion handling requires a special
478
498
                   # hard-coded value
479
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')),),
480
510
            # File renamed/renamed differently
481
511
            (dict(_base_actions='create_file'),
482
512
             ('file_renamed',
551
581
    def check_dir_doesnt_exist(self):
552
582
        self.failIfExists('branch/dir')
553
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
 
554
598
    def _get_resolve_path_arg(self, wt, action):
555
599
        tpath = self._this['path']
556
600
        opath = self._other['path']