~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_transform.py

  • Committer: Vincent Ladeuil
  • Date: 2010-09-21 16:58:50 UTC
  • mto: (5502.1.1 trunk)
  • mto: This revision was merged to the branch mainline in revision 5504.
  • Revision ID: v.ladeuil+lp@free.fr-20100921165850-fkrlj18p68l7xxz4
Revert to 'conflict' being the default orphaning policy and fix fallouts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2362
2362
        # parent
2363
2363
        self.assertLength(2, conflicts)
2364
2364
 
2365
 
    def test_resolve_orphan_non_versioned_file(self):
 
2365
    def test_non_versioned_file_create_conflict(self):
2366
2366
        wt, tt = self.make_tt_with_versioned_dir()
2367
2367
        dir_tid = tt.trans_id_tree_file_id('dir-id')
2368
2368
        tt.new_file('file', dir_tid, 'Contents')
2370
2370
        tt.unversion_file(dir_tid)
2371
2371
        conflicts = resolve_conflicts(tt)
2372
2372
        # no conflicts or rather: orphaning 'file' resolve the 'dir' conflict
2373
 
        self.assertLength(0, conflicts)
 
2373
        self.assertLength(1, conflicts)
 
2374
        self.assertEqual(('deleting parent', 'Not deleting', 'new-1'),
 
2375
                         conflicts.pop())
2374
2376
 
2375
2377
 
2376
2378
A_ENTRY = ('a-id', ('a', 'a'), True, (True, True),
3284
3286
 
3285
3287
    def test_new_orphan_created(self):
3286
3288
        wt = self.make_branch_and_tree('.')
 
3289
        self._set_orphan_policy(wt, 'move')
3287
3290
        tt, orphan_tid = self._prepare_orphan(wt)
3288
3291
        remaining_conflicts = resolve_conflicts(tt)
3289
3292
        # Yeah for resolved conflicts !
3295
3298
 
3296
3299
    def test_never_orphan(self):
3297
3300
        wt = self.make_branch_and_tree('.')
3298
 
        self._set_orphan_policy(wt, 'never')
 
3301
        self._set_orphan_policy(wt, 'conflict')
3299
3302
        tt, orphan_tid = self._prepare_orphan(wt)
3300
3303
        remaining_conflicts = resolve_conflicts(tt)
3301
3304
        self.assertLength(1, remaining_conflicts)
3326
3329
            warnings.append(args[0] % args[1:])
3327
3330
        self.overrideAttr(trace, 'warning', warning)
3328
3331
        remaining_conflicts = resolve_conflicts(tt)
3329
 
        # We fallback to the default policy which resolve the conflict by
3330
 
        # creating an orphan
3331
 
        self.assertLength(0, remaining_conflicts)
3332
 
        self.assertLength(2, warnings)
3333
 
        self.assertStartsWith( warnings[0], 'donttouchmypreciouuus')
3334
 
        self.assertStartsWith(warnings[1], 'dir/foo has been orphaned')
 
3332
        # We fallback to the default policy which create a conflict
 
3333
        self.assertLength(1, remaining_conflicts)
 
3334
        self.assertEqual(('deleting parent', 'Not deleting', 'new-1'),
 
3335
                         remaining_conflicts.pop())
 
3336
        self.assertLength(1, warnings)
 
3337
        self.assertStartsWith(warnings[0], 'donttouchmypreciouuus')