~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-11-24 16:01:57 UTC
  • mfrom: (4597.13.7 cleanup)
  • mto: This revision was merged to the branch mainline in revision 5558.
  • Revision ID: v.ladeuil+lp@free.fr-20101124160157-kieuslo7wj9abdmb
Merge cleanup into 638451-malformed

Show diffs side-by-side

added added

removed removed

Lines of Context:
3272
3272
                                               policy)
3273
3273
 
3274
3274
    def _prepare_orphan(self, wt):
3275
 
        self.build_tree(['dir/', 'dir/foo'])
3276
 
        wt.add(['dir'], ['dir-id'])
3277
 
        wt.commit('add dir')
 
3275
        self.build_tree(['dir/', 'dir/file', 'dir/foo'])
 
3276
        wt.add(['dir', 'dir/file'], ['dir-id', 'file-id'])
 
3277
        wt.commit('add dir and file ignoring foo')
3278
3278
        tt = transform.TreeTransform(wt)
3279
3279
        self.addCleanup(tt.finalize)
 
3280
        # dir and bar are deleted
3280
3281
        dir_tid = tt.trans_id_tree_path('dir')
 
3282
        file_tid = tt.trans_id_tree_path('dir/file')
3281
3283
        orphan_tid = tt.trans_id_tree_path('dir/foo')
 
3284
        tt.delete_contents(file_tid)
 
3285
        tt.unversion_file(file_tid)
3282
3286
        tt.delete_contents(dir_tid)
3283
3287
        tt.unversion_file(dir_tid)
 
3288
        # There should be a conflict because dir still contain foo
3284
3289
        raw_conflicts = tt.find_conflicts()
3285
3290
        self.assertLength(1, raw_conflicts)
3286
3291
        self.assertEqual(('missing parent', 'new-1'), raw_conflicts[0])
3290
3295
        wt = self.make_branch_and_tree('.')
3291
3296
        self._set_orphan_policy(wt, 'move')
3292
3297
        tt, orphan_tid = self._prepare_orphan(wt)
 
3298
        warnings = []
 
3299
        def warning(*args):
 
3300
            warnings.append(args[0] % args[1:])
 
3301
        self.overrideAttr(trace, 'warning', warning)
3293
3302
        remaining_conflicts = resolve_conflicts(tt)
 
3303
        self.assertEquals(['dir/foo has been orphaned in bzr-orphans'],
 
3304
                          warnings)
3294
3305
        # Yeah for resolved conflicts !
3295
3306
        self.assertLength(0, remaining_conflicts)
3296
3307
        # We have a new orphan