/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 tests/test_generic_processor.py

  • Committer: Ian Clatworthy
  • Date: 2009-02-20 03:35:45 UTC
  • mto: (0.64.124 trunk)
  • mto: This revision was merged to the branch mainline in revision 6631.
  • Revision ID: ian.clatworthy@canonical.com-20090220033545-mto5etovaxh8hod5
add directory delete test

Show diffs side-by-side

added added

removed removed

Lines of Context:
427
427
        self.assertSymlinkTarget(branch, revtree1, path, "aaa")
428
428
 
429
429
 
 
430
class TestDeleteDirectory(TestCaseForGenericProcessor):
 
431
 
 
432
    def file_command_iter(self, paths, dir):
 
433
        # Revno 1: create multiple files
 
434
        # Revno 2: delete a directory holding those files
 
435
        def command_list():
 
436
            author = ['', 'bugs@a.com', time.time(), time.timezone]
 
437
            committer = ['', 'elmer@a.com', time.time(), time.timezone]
 
438
            def files_one():
 
439
                for i, path in enumerate(paths):
 
440
                    yield commands.FileModifyCommand(path, 'file', False,
 
441
                            None, "aaa%d" % i)
 
442
            yield commands.CommitCommand('head', '1', author,
 
443
                committer, "commit 1", None, [], files_one)
 
444
            def files_two():
 
445
                yield commands.FileDeleteCommand(dir)
 
446
            yield commands.CommitCommand('head', '2', author,
 
447
                committer, "commit 2", ":1", [], files_two)
 
448
        return command_list
 
449
 
 
450
    def test_delete_dir(self):
 
451
        handler, branch = self.get_handler()
 
452
        paths = ['a/b/c', 'a/b/d', 'a/b/e/f', 'a/g']
 
453
        dir = 'a/b'
 
454
        handler.process(self.file_command_iter(paths, dir))
 
455
        revtree0, revtree1 = self.assertChanges(branch, 1,
 
456
            expected_added=[
 
457
                ('a',), ('a/b',), ('a/b/c',),
 
458
                ('a/b/d',),
 
459
                ('a/b/e',), ('a/b/e/f',),
 
460
                ('a/g',),
 
461
                ])
 
462
        revtree1, revtree2 = self.assertChanges(branch, 2,
 
463
            expected_removed=[
 
464
                ('a/b',), ('a/b/c',),
 
465
                ('a/b/d',),
 
466
                ('a/b/e',), ('a/b/e/f',),
 
467
                ])
 
468
 
 
469
 
430
470
class TestRename(TestCaseForGenericProcessor):
431
471
 
432
472
    def get_command_iter(self, old_path, new_path):