~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_missing.py

  • Committer: John Arbash Meinel
  • Date: 2007-05-24 12:19:25 UTC
  • mto: This revision was merged to the branch mainline in revision 2491.
  • Revision ID: john@arbash-meinel.com-20070524121925-jf60fhqgvtcy6n0g
Restore the test for iter_log_data as a deprecated function.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
from bzrlib.builtins import merge
21
21
from bzrlib.missing import (
22
22
    find_unmerged,
 
23
    iter_log_data,
23
24
    iter_log_revisions,
24
25
    )
 
26
from bzrlib.symbol_versioning import zero_seventeen
25
27
from bzrlib.tests import TestCaseWithTransport
26
28
from bzrlib.workingtree import WorkingTree
27
29
 
56
58
        merger_tree.commit('d', rev_id='d')
57
59
        self.assertEqual(find_unmerged(original, merger), ([], [(2, 'd')]))
58
60
 
 
61
    def test_iter_log_data(self):
 
62
        base_tree = self.make_branch_and_tree('base')
 
63
        self.build_tree(['base/a'])
 
64
        base_tree.add(['a'], ['a-id'])
 
65
        base_tree.commit('add a', rev_id='b-1')
 
66
 
 
67
        child_tree = base_tree.bzrdir.sprout('child').open_workingtree()
 
68
 
 
69
        self.build_tree(['child/b'])
 
70
        child_tree.add(['b'], ['b-id'])
 
71
        child_tree.commit('adding b', rev_id='c-2')
 
72
 
 
73
        child_tree.remove(['a'])
 
74
        child_tree.commit('removing a', rev_id='c-3')
 
75
 
 
76
        self.build_tree_contents([('child/b', 'new contents for b\n')])
 
77
        child_tree.commit('modifying b', rev_id='c-4')
 
78
 
 
79
        child_tree.rename_one('b', 'c')
 
80
        child_tree.commit('rename b=>c', rev_id='c-5')
 
81
 
 
82
        base_extra, child_extra = find_unmerged(base_tree.branch,
 
83
                                                child_tree.branch)
 
84
        results = list(self.applyDeprecated(zero_seventeen, iter_log_data,
 
85
                            base_extra,
 
86
                            base_tree.branch.repository,
 
87
                            verbose=True))
 
88
        self.assertEqual([], results)
 
89
 
 
90
        results = list(self.applyDeprecated(zero_seventeen, iter_log_data,
 
91
                            child_extra,
 
92
                            child_tree.branch.repository,
 
93
                            verbose=True))
 
94
        self.assertEqual(4, len(results))
 
95
 
 
96
        r0,r1,r2,r3 = results
 
97
 
 
98
        self.assertEqual((2, 'c-2'), (r0[0], r0[1].revision_id))
 
99
        self.assertEqual((3, 'c-3'), (r1[0], r1[1].revision_id))
 
100
        self.assertEqual((4, 'c-4'), (r2[0], r2[1].revision_id))
 
101
        self.assertEqual((5, 'c-5'), (r3[0], r3[1].revision_id))
 
102
 
 
103
        delta0 = r0[2]
 
104
        self.assertNotEqual(None, delta0)
 
105
        self.assertEqual([('b', 'b-id', 'file')], delta0.added)
 
106
        self.assertEqual([], delta0.removed)
 
107
        self.assertEqual([], delta0.renamed)
 
108
        self.assertEqual([], delta0.modified)
 
109
 
 
110
        delta1 = r1[2]
 
111
        self.assertNotEqual(None, delta1)
 
112
        self.assertEqual([], delta1.added)
 
113
        self.assertEqual([('a', 'a-id', 'file')], delta1.removed)
 
114
        self.assertEqual([], delta1.renamed)
 
115
        self.assertEqual([], delta1.modified)
 
116
 
 
117
        delta2 = r2[2]
 
118
        self.assertNotEqual(None, delta2)
 
119
        self.assertEqual([], delta2.added)
 
120
        self.assertEqual([], delta2.removed)
 
121
        self.assertEqual([], delta2.renamed)
 
122
        self.assertEqual([('b', 'b-id', 'file', True, False)], delta2.modified)
 
123
 
 
124
        delta3 = r3[2]
 
125
        self.assertNotEqual(None, delta3)
 
126
        self.assertEqual([], delta3.added)
 
127
        self.assertEqual([], delta3.removed)
 
128
        self.assertEqual([('b', 'c', 'b-id', 'file', False, False)],
 
129
                         delta3.renamed)
 
130
        self.assertEqual([], delta3.modified)
 
131
 
59
132
    def test_iter_log_revisions(self):
60
133
        base_tree = self.make_branch_and_tree('base')
61
134
        self.build_tree(['base/a'])