~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: 2010-11-11 08:45:19 UTC
  • mfrom: (4597.9.22 reports-conflict-resolved)
  • Revision ID: pqm@pqm.ubuntu.com-20101111084519-bmk1zmblp7kex41a
(vila) More feedback about the conflicts just resolved and the remaining
 ones. (Vincent Ladeuil)

Show diffs side-by-side

added added

removed removed

Lines of Context:
2381
2381
                  ('TREE_ROOT', 'TREE_ROOT'), ('a', 'a'), ('file', 'file'),
2382
2382
                  (False, False))
2383
2383
ROOT_ENTRY = ('TREE_ROOT', ('', ''), False, (True, True), (None, None),
2384
 
              ('', ''), ('directory', 'directory'), (False, False))
 
2384
              ('', ''), ('directory', 'directory'), (False, None))
2385
2385
 
2386
2386
 
2387
2387
class TestTransformPreview(tests.TestCaseWithTransport):
2474
2474
        revision_tree, preview_tree = self.get_tree_and_preview_tree()
2475
2475
        changes = preview_tree.iter_changes(revision_tree,
2476
2476
                                            specific_files=[''])
2477
 
        self.assertEqual([A_ENTRY], list(changes))
 
2477
        self.assertEqual([ROOT_ENTRY, A_ENTRY], list(changes))
2478
2478
 
2479
2479
    def test_want_unversioned(self):
2480
2480
        revision_tree, preview_tree = self.get_tree_and_preview_tree()
2481
2481
        changes = preview_tree.iter_changes(revision_tree,
2482
2482
                                            want_unversioned=True)
2483
 
        self.assertEqual([A_ENTRY], list(changes))
 
2483
        self.assertEqual([ROOT_ENTRY, A_ENTRY], list(changes))
2484
2484
 
2485
2485
    def test_ignore_extra_trees_no_specific_files(self):
2486
2486
        # extra_trees is harmless without specific_files, so we'll silently
3272
3272
                                               policy)
3273
3273
 
3274
3274
    def _prepare_orphan(self, wt):
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')
 
3275
        self.build_tree(['dir/', 'dir/foo'])
 
3276
        wt.add(['dir'], ['dir-id'])
 
3277
        wt.commit('add dir')
3278
3278
        tt = transform.TreeTransform(wt)
3279
3279
        self.addCleanup(tt.finalize)
3280
 
        # dir and bar are deleted
3281
3280
        dir_tid = tt.trans_id_tree_path('dir')
3282
 
        file_tid = tt.trans_id_tree_path('dir/file')
3283
3281
        orphan_tid = tt.trans_id_tree_path('dir/foo')
3284
 
        tt.delete_contents(file_tid)
3285
 
        tt.unversion_file(file_tid)
3286
3282
        tt.delete_contents(dir_tid)
3287
3283
        tt.unversion_file(dir_tid)
3288
 
        # There should be a conflict because dir still contain foo
3289
3284
        raw_conflicts = tt.find_conflicts()
3290
3285
        self.assertLength(1, raw_conflicts)
3291
3286
        self.assertEqual(('missing parent', 'new-1'), raw_conflicts[0])
3295
3290
        wt = self.make_branch_and_tree('.')
3296
3291
        self._set_orphan_policy(wt, 'move')
3297
3292
        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)
3302
3293
        remaining_conflicts = resolve_conflicts(tt)
3303
 
        self.assertEquals(['dir/foo has been orphaned in bzr-orphans'],
3304
 
                          warnings)
3305
3294
        # Yeah for resolved conflicts !
3306
3295
        self.assertLength(0, remaining_conflicts)
3307
3296
        # We have a new orphan