~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_delta.py

  • Committer: Robert Collins
  • Date: 2007-03-05 01:15:25 UTC
  • mto: (2255.11.4 dirstate)
  • mto: This revision was merged to the branch mainline in revision 2322.
  • Revision ID: robertc@robertcollins.net-20070305011525-fakb9irlbxyxaukb
Change _iter_changes interface to yield both old and new paths.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
from bzrlib import (
21
21
    delta as _mod_delta,
22
 
    inventory,
23
22
    tests,
24
23
    )
25
24
 
44
43
        result = []
45
44
        def result_line(format, *args):
46
45
            result.append(format % args)
47
 
        inv = inventory.Inventory()
48
 
        if old_path is not None:
49
 
            inv.add(inventory.InventoryFile(file_id, old_path,
50
 
                                            inv.root.file_id))
51
 
        reporter = _mod_delta.ChangeReporter(inv, result_line)
52
 
        reporter.report(file_id, path, versioned_change, renamed, modified,
53
 
                         exe_change, kind)
 
46
        reporter = _mod_delta.ChangeReporter(result_line)
 
47
        reporter.report(file_id, (old_path, path), versioned_change, renamed,
 
48
            modified, exe_change, kind)
54
49
        self.assertEqualDiff(expected, result[0])
55
50
 
56
51
    def test_rename(self):
61
56
 
62
57
    def test_kind(self):
63
58
        self.assertReport(' K  path => path/', modified='kind changed',
64
 
                          kind=('file', 'directory'))
 
59
                          kind=('file', 'directory'), old_path='path')
65
60
        self.assertReport(' K  path/ => path', modified='kind changed',
66
61
                          kind=('directory', 'file'), old_path='old')
67
62
        self.assertReport('RK  old => path/', renamed=True,
78
73
                          modified='created', kind=(None, 'directory'))
79
74
        self.assertReport('+M  path/', versioned_change='added',
80
75
                          modified='modified', kind=(None, 'directory'))
81
 
        self.assertReport('+K  path => path/', versioned_change='added',
82
 
                          modified='kind changed', kind=('file', 'directory'))
83
76
 
84
77
    def test_removal(self):
85
78
        self.assertReport(' D  path/', modified='deleted',