~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-10 16:25:28 UTC
  • mfrom: (5020.1.1 integration)
  • Revision ID: pqm@pqm.ubuntu.com-20100210162528-00g29u0ex6vzv914
(gerard) Update performs two merges in a more logical order but stop
        on conflicts

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
158
158
        self.make_linear_branch()
159
159
        self.assertLogRevnos(['-c1'], ['1'])
160
160
 
161
 
    def test_branch_revspec(self):
162
 
        foo = self.make_branch_and_tree('foo')
163
 
        bar = self.make_branch_and_tree('bar')
164
 
        self.build_tree(['foo/foo.txt', 'bar/bar.txt'])
165
 
        foo.add('foo.txt')
166
 
        bar.add('bar.txt')
167
 
        foo.commit(message='foo')
168
 
        bar.commit(message='bar')
169
 
        self.run_bzr('log -r branch:../bar', working_dir='foo')
170
 
        self.assertEqual([bar.branch.get_rev_id(1)],
171
 
                         [r.rev.revision_id
172
 
                          for r in self.get_captured_revisions()])
173
 
 
174
 
 
175
 
class TestLogExcludeCommonAncestry(TestLogWithLogCatcher):
176
 
 
177
 
    def test_exclude_common_ancestry_simple_revnos(self):
178
 
        self.make_linear_branch()
179
 
        self.assertLogRevnos(['-r1..3', '--exclude-common-ancestry'],
180
 
                             ['3', '2'])
181
 
 
182
161
 
183
162
class TestLogMergedLinearAncestry(TestLogWithLogCatcher):
184
163
 
188
167
        # stop calling run_bzr, there is no point) --vila 100118.
189
168
        builder = branchbuilder.BranchBuilder(self.get_transport())
190
169
        builder.start_series()
191
 
        # 1
192
 
        # | \
193
 
        # 2  1.1.1
194
 
        # | / |
195
 
        # 3  1.1.2
196
 
        # |   |
197
 
        # |  1.1.3
198
 
        # | / |
199
 
        # 4  1.1.4
200
 
        # | /
201
 
        # 5
202
 
 
203
170
        # mainline
204
171
        builder.build_snapshot('1', None, [
205
172
            ('add', ('', 'root-id', 'directory', ''))])
238
205
 
239
206
class Test_GenerateAllRevisions(TestLogWithLogCatcher):
240
207
 
241
 
    def setUp(self):
242
 
        super(Test_GenerateAllRevisions, self).setUp()
243
 
        builder = self.make_branch_with_many_merges()
244
 
        b = builder.get_branch()
245
 
        b.lock_read()
246
 
        self.addCleanup(b.unlock)
247
 
        self.branch = b
248
 
 
249
208
    def make_branch_with_many_merges(self, path='.', format=None):
250
209
        builder = branchbuilder.BranchBuilder(self.get_transport())
251
210
        builder.start_series()
267
226
        return builder
268
227
 
269
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)
270
233
        self.assertRaises(errors.BzrCommandError,
271
234
                          log._generate_all_revisions,
272
 
                          self.branch, '1.1.1', '2.1.3', 'reverse',
 
235
                          b, '1.1.1', '2.1.3', 'reverse',
273
236
                          delayed_graph_generation=True)
274
237
 
275
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)
276
243
        self.assertRaises(errors.BzrCommandError,
277
244
                          log._generate_all_revisions,
278
 
                          self.branch, '5', '2.1.3', 'reverse',
 
245
                          b, '5', '2.1.3', 'reverse',
279
246
                          delayed_graph_generation=True)
280
247
 
281
 
    def test_no_start_rev_id_with_end_rev_id_being_a_merge(self):
282
 
        revs = log._generate_all_revisions(
283
 
            self.branch, None, '2.1.3',
284
 
            'reverse', delayed_graph_generation=True)
285
 
 
286
248
 
287
249
class TestLogRevSpecsWithPaths(TestLogWithLogCatcher):
288
250
 
381
343
 
382
344
    def test_log_bad_message_re(self):
383
345
        """Bad --message argument gives a sensible message
384
 
 
 
346
        
385
347
        See https://bugs.launchpad.net/bzr/+bug/251352
386
348
        """
387
349
        self.make_minimal_branch()
388
350
        out, err = self.run_bzr(['log', '-m', '*'], retcode=3)
389
 
        self.assertContainsRe(err, "ERROR.*Invalid pattern.*nothing to repeat")
390
 
        self.assertNotContainsRe(err, "Unprintable exception")
391
 
        self.assertEqual(out, '')
 
351
        self.assertEqual("bzr: ERROR: Invalid regular expression"
 
352
            " in log message filter"
 
353
            ": '*'"
 
354
            ": nothing to repeat\n", err)
 
355
        self.assertEqual('', out)
392
356
 
393
357
    def test_log_unsupported_timezone(self):
394
358
        self.make_linear_branch()
396
360
                            'options are "utc", "original", "local".'],
397
361
                           ['log', '--timezone', 'foo'])
398
362
 
399
 
    def test_log_exclude_ancestry_no_range(self):
400
 
        self.make_linear_branch()
401
 
        self.run_bzr_error(['bzr: ERROR: --exclude-common-ancestry'
402
 
                            ' requires -r with two revisions'],
403
 
                           ['log', '--exclude-common-ancestry'])
404
 
 
405
 
    def test_log_exclude_ancestry_single_revision(self):
406
 
        self.make_merged_branch()
407
 
        self.run_bzr_error(['bzr: ERROR: --exclude-common-ancestry'
408
 
                            ' requires two different revisions'],
409
 
                           ['log', '--exclude-common-ancestry',
410
 
                            '-r1.1.1..1.1.1'])
411
363
 
412
364
class TestLogTags(TestLog):
413
365