~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_log.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-02-03 09:35:22 UTC
  • mfrom: (4999.2.1 integration2)
  • Revision ID: pqm@pqm.ubuntu.com-20100203093522-2j28jn5huknayntu
(vila) Fix ``log`` to better check ancestors even if merged revisions
        are involved

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
from bzrlib import (
25
25
    branchbuilder,
 
26
    errors,
26
27
    log,
27
28
    osutils,
28
29
    tests,
158
159
        self.assertLogRevnos(['-c1'], ['1'])
159
160
 
160
161
 
161
 
class TestBug474807(TestLogWithLogCatcher):
 
162
class TestLogMergedLinearAncestry(TestLogWithLogCatcher):
162
163
 
163
164
    def setUp(self):
164
 
        super(TestBug474807, self).setUp()
 
165
        super(TestLogMergedLinearAncestry, self).setUp()
165
166
        # FIXME: Using a MemoryTree would be even better here (but until we
166
167
        # stop calling run_bzr, there is no point) --vila 100118.
167
168
        builder = branchbuilder.BranchBuilder(self.get_transport())
202
203
                             ['1.1.1', '1.1.2', '1.1.3', '1.1.4'])
203
204
 
204
205
 
 
206
class Test_GenerateAllRevisions(TestLogWithLogCatcher):
 
207
 
 
208
    def make_branch_with_many_merges(self, path='.', format=None):
 
209
        builder = branchbuilder.BranchBuilder(self.get_transport())
 
210
        builder.start_series()
 
211
        # The graph below may look a bit complicated (and it may be but I've
 
212
        # banged my head enough on it) but the bug requires at least dotted
 
213
        # revnos *and* merged revisions below that.
 
214
        builder.build_snapshot('1', None, [
 
215
            ('add', ('', 'root-id', 'directory', ''))])
 
216
        builder.build_snapshot('2', ['1'], [])
 
217
        builder.build_snapshot('1.1.1', ['1'], [])
 
218
        builder.build_snapshot('2.1.1', ['2'], [])
 
219
        builder.build_snapshot('3', ['2', '1.1.1'], [])
 
220
        builder.build_snapshot('2.1.2', ['2.1.1'], [])
 
221
        builder.build_snapshot('2.2.1', ['2.1.1'], [])
 
222
        builder.build_snapshot('2.1.3', ['2.1.2', '2.2.1'], [])
 
223
        builder.build_snapshot('4', ['3', '2.1.3'], [])
 
224
        builder.build_snapshot('5', ['4', '2.1.2'], [])
 
225
        builder.finish_series()
 
226
        return builder
 
227
 
 
228
    def test_not_an_ancestor(self):
 
229
        builder = self.make_branch_with_many_merges()
 
230
        b = builder.get_branch()
 
231
        b.lock_read()
 
232
        self.addCleanup(b.unlock)
 
233
        self.assertRaises(errors.BzrCommandError,
 
234
                          log._generate_all_revisions,
 
235
                          b, '1.1.1', '2.1.3', 'reverse',
 
236
                          delayed_graph_generation=True)
 
237
 
 
238
    def test_wrong_order(self):
 
239
        builder = self.make_branch_with_many_merges()
 
240
        b = builder.get_branch()
 
241
        b.lock_read()
 
242
        self.addCleanup(b.unlock)
 
243
        self.assertRaises(errors.BzrCommandError,
 
244
                          log._generate_all_revisions,
 
245
                          b, '5', '2.1.3', 'reverse',
 
246
                          delayed_graph_generation=True)
 
247
 
 
248
 
205
249
class TestLogRevSpecsWithPaths(TestLogWithLogCatcher):
206
250
 
207
251
    def test_log_revno_n_path_wrong_namespace(self):
210
254
        # There is no guarantee that a path exist between two arbitrary
211
255
        # revisions.
212
256
        self.run_bzr("log -r revno:2:branch1..revno:3:branch2", retcode=3)
213
 
        # But may be it's worth trying though ? -- vila 100115
214
257
 
215
258
    def test_log_revno_n_path_correct_order(self):
216
259
        self.make_linear_branch('branch2')