~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-09-29 22:03:03 UTC
  • mfrom: (5416.2.6 jam-integration)
  • Revision ID: pqm@pqm.ubuntu.com-20100929220303-cr95h8iwtggco721
(mbp) Add 'break-lock --force'

Show diffs side-by-side

added added

removed removed

Lines of Context:
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
 
161
182
 
162
183
class TestLogMergedLinearAncestry(TestLogWithLogCatcher):
163
184
 
167
188
        # stop calling run_bzr, there is no point) --vila 100118.
168
189
        builder = branchbuilder.BranchBuilder(self.get_transport())
169
190
        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
 
170
203
        # mainline
171
204
        builder.build_snapshot('1', None, [
172
205
            ('add', ('', 'root-id', 'directory', ''))])
205
238
 
206
239
class Test_GenerateAllRevisions(TestLogWithLogCatcher):
207
240
 
 
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
 
208
249
    def make_branch_with_many_merges(self, path='.', format=None):
209
250
        builder = branchbuilder.BranchBuilder(self.get_transport())
210
251
        builder.start_series()
226
267
        return builder
227
268
 
228
269
    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
270
        self.assertRaises(errors.BzrCommandError,
234
271
                          log._generate_all_revisions,
235
 
                          b, '1.1.1', '2.1.3', 'reverse',
 
272
                          self.branch, '1.1.1', '2.1.3', 'reverse',
236
273
                          delayed_graph_generation=True)
237
274
 
238
275
    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
276
        self.assertRaises(errors.BzrCommandError,
244
277
                          log._generate_all_revisions,
245
 
                          b, '5', '2.1.3', 'reverse',
 
278
                          self.branch, '5', '2.1.3', 'reverse',
246
279
                          delayed_graph_generation=True)
247
280
 
 
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
 
248
286
 
249
287
class TestLogRevSpecsWithPaths(TestLogWithLogCatcher):
250
288
 
343
381
 
344
382
    def test_log_bad_message_re(self):
345
383
        """Bad --message argument gives a sensible message
346
 
        
 
384
 
347
385
        See https://bugs.launchpad.net/bzr/+bug/251352
348
386
        """
349
387
        self.make_minimal_branch()
350
388
        out, err = self.run_bzr(['log', '-m', '*'], retcode=3)
351
 
        self.assertEqual("bzr: ERROR: Invalid regular expression"
352
 
            " in log message filter"
353
 
            ": '*'"
354
 
            ": nothing to repeat\n", err)
355
 
        self.assertEqual('', out)
 
389
        self.assertContainsRe(err, "ERROR.*Invalid pattern.*nothing to repeat")
 
390
        self.assertNotContainsRe(err, "Unprintable exception")
 
391
        self.assertEqual(out, '')
356
392
 
357
393
    def test_log_unsupported_timezone(self):
358
394
        self.make_linear_branch()
360
396
                            'options are "utc", "original", "local".'],
361
397
                           ['log', '--timezone', 'foo'])
362
398
 
 
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'])
363
411
 
364
412
class TestLogTags(TestLog):
365
413