/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 bzrlib/tests/blackbox/test_log.py

  • Committer: Vincent Ladeuil
  • Date: 2010-01-25 17:48:22 UTC
  • mto: (4987.1.1 integration)
  • mto: This revision was merged to the branch mainline in revision 4988.
  • Revision ID: v.ladeuil+lp@free.fr-20100125174822-nce4l19sbwx83jvq
Deploying the new overrideAttr facility further reduces the complexity
and make the code clearer.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 Canonical Ltd
 
1
# Copyright (C) 2005, 2006, 2007, 2009 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
23
23
 
24
24
from bzrlib import (
25
25
    branchbuilder,
26
 
    errors,
27
26
    log,
28
27
    osutils,
29
28
    tests,
159
158
        self.assertLogRevnos(['-c1'], ['1'])
160
159
 
161
160
 
162
 
class TestLogMergedLinearAncestry(TestLogWithLogCatcher):
 
161
class TestBug474807(TestLogWithLogCatcher):
163
162
 
164
163
    def setUp(self):
165
 
        super(TestLogMergedLinearAncestry, self).setUp()
 
164
        super(TestBug474807, self).setUp()
166
165
        # FIXME: Using a MemoryTree would be even better here (but until we
167
166
        # stop calling run_bzr, there is no point) --vila 100118.
168
167
        builder = branchbuilder.BranchBuilder(self.get_transport())
203
202
                             ['1.1.1', '1.1.2', '1.1.3', '1.1.4'])
204
203
 
205
204
 
206
 
class Test_GenerateAllRevisions(TestLogWithLogCatcher):
207
 
 
208
 
    def setUp(self):
209
 
        super(Test_GenerateAllRevisions, self).setUp()
210
 
        builder = self.make_branch_with_many_merges()
211
 
        b = builder.get_branch()
212
 
        b.lock_read()
213
 
        self.addCleanup(b.unlock)
214
 
        self.branch = b
215
 
 
216
 
    def make_branch_with_many_merges(self, path='.', format=None):
217
 
        builder = branchbuilder.BranchBuilder(self.get_transport())
218
 
        builder.start_series()
219
 
        # The graph below may look a bit complicated (and it may be but I've
220
 
        # banged my head enough on it) but the bug requires at least dotted
221
 
        # revnos *and* merged revisions below that.
222
 
        builder.build_snapshot('1', None, [
223
 
            ('add', ('', 'root-id', 'directory', ''))])
224
 
        builder.build_snapshot('2', ['1'], [])
225
 
        builder.build_snapshot('1.1.1', ['1'], [])
226
 
        builder.build_snapshot('2.1.1', ['2'], [])
227
 
        builder.build_snapshot('3', ['2', '1.1.1'], [])
228
 
        builder.build_snapshot('2.1.2', ['2.1.1'], [])
229
 
        builder.build_snapshot('2.2.1', ['2.1.1'], [])
230
 
        builder.build_snapshot('2.1.3', ['2.1.2', '2.2.1'], [])
231
 
        builder.build_snapshot('4', ['3', '2.1.3'], [])
232
 
        builder.build_snapshot('5', ['4', '2.1.2'], [])
233
 
        builder.finish_series()
234
 
        return builder
235
 
 
236
 
    def test_not_an_ancestor(self):
237
 
        self.assertRaises(errors.BzrCommandError,
238
 
                          log._generate_all_revisions,
239
 
                          self.branch, '1.1.1', '2.1.3', 'reverse',
240
 
                          delayed_graph_generation=True)
241
 
 
242
 
    def test_wrong_order(self):
243
 
        self.assertRaises(errors.BzrCommandError,
244
 
                          log._generate_all_revisions,
245
 
                          self.branch, '5', '2.1.3', 'reverse',
246
 
                          delayed_graph_generation=True)
247
 
 
248
 
    def test_no_start_rev_id_with_end_rev_id_being_a_merge(self):
249
 
        revs = log._generate_all_revisions(
250
 
            self.branch, None, '2.1.3',
251
 
            'reverse', delayed_graph_generation=True)
252
 
 
253
 
 
254
205
class TestLogRevSpecsWithPaths(TestLogWithLogCatcher):
255
206
 
256
207
    def test_log_revno_n_path_wrong_namespace(self):
259
210
        # There is no guarantee that a path exist between two arbitrary
260
211
        # revisions.
261
212
        self.run_bzr("log -r revno:2:branch1..revno:3:branch2", retcode=3)
 
213
        # But may be it's worth trying though ? -- vila 100115
262
214
 
263
215
    def test_log_revno_n_path_correct_order(self):
264
216
        self.make_linear_branch('branch2')
365
317
                            'options are "utc", "original", "local".'],
366
318
                           ['log', '--timezone', 'foo'])
367
319
 
368
 
    def test_log_exclude_ancestry_no_range(self):
369
 
        self.make_linear_branch()
370
 
        self.run_bzr_error(['bzr: ERROR: --exclude-common-ancestry'
371
 
                            ' requires -r with two revisions'],
372
 
                           ['log', '--exclude-common-ancestry'])
373
 
 
374
 
    def test_log_exclude_ancestry_single_revision(self):
375
 
        self.make_merged_branch()
376
 
        self.run_bzr_error(['bzr: ERROR: --exclude-common-ancestry'
377
 
                            ' requires two different revisions'],
378
 
                           ['log', '--exclude-common-ancestry',
379
 
                            '-r1.1.1..1.1.1'])
380
320
 
381
321
class TestLogTags(TestLog):
382
322