~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_missing.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2007-04-26 15:39:04 UTC
  • mfrom: (2456.2.6 rename_iter_changes_109993)
  • Revision ID: pqm@pqm.ubuntu.com-20070426153904-l91p9ybsqpxt2vyv
(John Arbash Meinel) Fix bug #109993 by fixing _iter_changes to not sync an on-disk file with an 'absent' dirblock record.

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
 
19
19
 
20
20
from bzrlib.builtins import merge
21
 
from bzrlib.missing import (
22
 
    find_unmerged,
23
 
    iter_log_data,
24
 
    iter_log_revisions,
25
 
    )
26
 
from bzrlib.symbol_versioning import zero_seventeen
 
21
from bzrlib.missing import find_unmerged, iter_log_data
27
22
from bzrlib.tests import TestCaseWithTransport
28
23
from bzrlib.workingtree import WorkingTree
29
24
 
81
76
 
82
77
        base_extra, child_extra = find_unmerged(base_tree.branch,
83
78
                                                child_tree.branch)
84
 
        results = list(self.applyDeprecated(zero_seventeen, iter_log_data,
85
 
                            base_extra,
86
 
                            base_tree.branch.repository,
87
 
                            verbose=True))
 
79
        results = list(iter_log_data(base_extra, base_tree.branch.repository,
 
80
                                     verbose=True))
88
81
        self.assertEqual([], results)
89
82
 
90
 
        results = list(self.applyDeprecated(zero_seventeen, iter_log_data,
91
 
                            child_extra,
92
 
                            child_tree.branch.repository,
93
 
                            verbose=True))
 
83
        results = list(iter_log_data(child_extra, child_tree.branch.repository,
 
84
                                     verbose=True))
94
85
        self.assertEqual(4, len(results))
95
86
 
96
87
        r0,r1,r2,r3 = results
128
119
        self.assertEqual([('b', 'c', 'b-id', 'file', False, False)],
129
120
                         delta3.renamed)
130
121
        self.assertEqual([], delta3.modified)
131
 
 
132
 
    def test_iter_log_revisions(self):
133
 
        base_tree = self.make_branch_and_tree('base')
134
 
        self.build_tree(['base/a'])
135
 
        base_tree.add(['a'], ['a-id'])
136
 
        base_tree.commit('add a', rev_id='b-1')
137
 
 
138
 
        child_tree = base_tree.bzrdir.sprout('child').open_workingtree()
139
 
 
140
 
        self.build_tree(['child/b'])
141
 
        child_tree.add(['b'], ['b-id'])
142
 
        child_tree.commit('adding b', rev_id='c-2')
143
 
 
144
 
        child_tree.remove(['a'])
145
 
        child_tree.commit('removing a', rev_id='c-3')
146
 
 
147
 
        self.build_tree_contents([('child/b', 'new contents for b\n')])
148
 
        child_tree.commit('modifying b', rev_id='c-4')
149
 
 
150
 
        child_tree.rename_one('b', 'c')
151
 
        child_tree.commit('rename b=>c', rev_id='c-5')
152
 
 
153
 
        base_extra, child_extra = find_unmerged(base_tree.branch,
154
 
                                                child_tree.branch)
155
 
        results = list(iter_log_revisions(base_extra, 
156
 
                            base_tree.branch.repository,
157
 
                            verbose=True))
158
 
        self.assertEqual([], results)
159
 
 
160
 
        results = list(iter_log_revisions(child_extra,
161
 
                            child_tree.branch.repository,
162
 
                            verbose=True))
163
 
        self.assertEqual(4, len(results))
164
 
 
165
 
        r0,r1,r2,r3 = results
166
 
 
167
 
        self.assertEqual((2, 'c-2'), (r0.revno, r0.rev.revision_id))
168
 
        self.assertEqual((3, 'c-3'), (r1.revno, r1.rev.revision_id))
169
 
        self.assertEqual((4, 'c-4'), (r2.revno, r2.rev.revision_id))
170
 
        self.assertEqual((5, 'c-5'), (r3.revno, r3.rev.revision_id))
171
 
 
172
 
        delta0 = r0.delta
173
 
        self.assertNotEqual(None, delta0)
174
 
        self.assertEqual([('b', 'b-id', 'file')], delta0.added)
175
 
        self.assertEqual([], delta0.removed)
176
 
        self.assertEqual([], delta0.renamed)
177
 
        self.assertEqual([], delta0.modified)
178
 
 
179
 
        delta1 = r1.delta
180
 
        self.assertNotEqual(None, delta1)
181
 
        self.assertEqual([], delta1.added)
182
 
        self.assertEqual([('a', 'a-id', 'file')], delta1.removed)
183
 
        self.assertEqual([], delta1.renamed)
184
 
        self.assertEqual([], delta1.modified)
185
 
 
186
 
        delta2 = r2.delta
187
 
        self.assertNotEqual(None, delta2)
188
 
        self.assertEqual([], delta2.added)
189
 
        self.assertEqual([], delta2.removed)
190
 
        self.assertEqual([], delta2.renamed)
191
 
        self.assertEqual([('b', 'b-id', 'file', True, False)], delta2.modified)
192
 
 
193
 
        delta3 = r3.delta
194
 
        self.assertNotEqual(None, delta3)
195
 
        self.assertEqual([], delta3.added)
196
 
        self.assertEqual([], delta3.removed)
197
 
        self.assertEqual([('b', 'c', 'b-id', 'file', False, False)],
198
 
                         delta3.renamed)
199
 
        self.assertEqual([], delta3.modified)