~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transform.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2006-09-06 12:20:16 UTC
  • mfrom: (1551.8.23 Aaron's mergeable stuff)
  • Revision ID: pqm@pqm.ubuntu.com-20060906122016-54ab3159023ef544
Improve conflict message for deleting directories with contents

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
from bzrlib import tests
20
20
from bzrlib.bzrdir import BzrDir
21
21
from bzrlib.conflicts import (DuplicateEntry, DuplicateID, MissingParent,
22
 
                              UnversionedParent, ParentLoop)
 
22
                              UnversionedParent, ParentLoop, DeletingParent,)
23
23
from bzrlib.errors import (DuplicateKey, MalformedTransform, NoSuchFile,
24
24
                           ReusingTransform, CantMoveRoot, 
25
25
                           PathsNotVersionedError, ExistingLimbo,
388
388
                                         'dorothy-id')
389
389
        old_dorothy = conflicts.trans_id_tree_file_id('dorothy-id')
390
390
        oz = conflicts.trans_id_tree_file_id('oz-id')
391
 
        # set up missing, unversioned parent
 
391
        # set up DeletedParent parent conflict
392
392
        conflicts.delete_versioned(oz)
393
393
        emerald = conflicts.trans_id_tree_file_id('emerald-id')
 
394
        # set up MissingParent conflict
 
395
        munchkincity = conflicts.trans_id_file_id('munchkincity-id')
 
396
        conflicts.adjust_path('munchkincity', root, munchkincity)
 
397
        conflicts.new_directory('auntem', munchkincity, 'auntem-id')
394
398
        # set up parent loop
395
399
        conflicts.adjust_path('emeraldcity', emerald, emerald)
396
400
        return conflicts, emerald, oz, old_dorothy, new_dorothy
417
421
                                   'dorothy.moved', 'dorothy', None,
418
422
                                   'dorothy-id')
419
423
        self.assertEqual(cooked_conflicts[1], duplicate_id)
420
 
        missing_parent = MissingParent('Not deleting', 'oz', 'oz-id')
 
424
        missing_parent = MissingParent('Created directory', 'munchkincity',
 
425
                                       'munchkincity-id')
 
426
        deleted_parent = DeletingParent('Not deleting', 'oz', 'oz-id')
421
427
        self.assertEqual(cooked_conflicts[2], missing_parent)
422
 
        unversioned_parent = UnversionedParent('Versioned directory', 'oz',
 
428
        unversioned_parent = UnversionedParent('Versioned directory',
 
429
                                               'munchkincity',
 
430
                                               'munchkincity-id')
 
431
        unversioned_parent2 = UnversionedParent('Versioned directory', 'oz',
423
432
                                               'oz-id')
424
433
        self.assertEqual(cooked_conflicts[3], unversioned_parent)
425
434
        parent_loop = ParentLoop('Cancelled move', 'oz/emeraldcity', 
426
435
                                 'oz/emeraldcity', 'emerald-id', 'emerald-id')
427
 
        self.assertEqual(cooked_conflicts[4], parent_loop)
428
 
        self.assertEqual(len(cooked_conflicts), 5)
 
436
        self.assertEqual(cooked_conflicts[4], deleted_parent)
 
437
        self.assertEqual(cooked_conflicts[5], unversioned_parent2)
 
438
        self.assertEqual(cooked_conflicts[6], parent_loop)
 
439
        self.assertEqual(len(cooked_conflicts), 7)
429
440
        tt.finalize()
430
441
 
431
442
    def test_string_conflicts(self):
441
452
        self.assertEqual(conflicts_s[1], 'Conflict adding id to dorothy.  '
442
453
                                         'Unversioned existing file '
443
454
                                         'dorothy.moved.')
444
 
        self.assertEqual(conflicts_s[2], 'Conflict adding files to oz.  '
445
 
                                         'Not deleting.')
446
 
        self.assertEqual(conflicts_s[3], 'Conflict adding versioned files to '
447
 
                                         'oz.  Versioned directory.')
448
 
        self.assertEqual(conflicts_s[4], 'Conflict moving oz/emeraldcity into'
 
455
        self.assertEqual(conflicts_s[2], 'Conflict adding files to'
 
456
                                         ' munchkincity.  Created directory.')
 
457
        self.assertEqual(conflicts_s[3], 'Conflict because munchkincity is not'
 
458
                                         ' versioned, but has versioned'
 
459
                                         ' children.  Versioned directory.')
 
460
        self.assertEqualDiff(conflicts_s[4], "Conflict: can't delete oz because it"
 
461
                                         " is not empty.  Not deleting.")
 
462
        self.assertEqual(conflicts_s[5], 'Conflict because oz is not'
 
463
                                         ' versioned, but has versioned'
 
464
                                         ' children.  Versioned directory.')
 
465
        self.assertEqual(conflicts_s[6], 'Conflict moving oz/emeraldcity into'
449
466
                                         ' oz/emeraldcity.  Cancelled move.')
450
467
 
451
468
    def test_moving_versioned_directories(self):