~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: 2009-01-29 07:18:57 UTC
  • mfrom: (3970.1.1 ianc-integration)
  • Revision ID: pqm@pqm.ubuntu.com-20090129071857-l3ikkrm6b1rx96bx
log -n/--levels (Ian Clatworthy)

Show diffs side-by-side

added added

removed removed

Lines of Context:
256
256
    def assertUseShortDeltaFormat(self, cmd):
257
257
        log = self.run_bzr(cmd)[0]
258
258
        # Check that we use the short status format
259
 
        self.assertContainsRe(log, '(?m)^A  hello.txt$')
260
 
        self.assertNotContainsRe(log, '(?m)^added:$')
 
259
        self.assertContainsRe(log, '(?m)^\s*A  hello.txt$')
 
260
        self.assertNotContainsRe(log, '(?m)^\s*added:$')
261
261
 
262
262
    def assertUseLongDeltaFormat(self, cmd):
263
263
        log = self.run_bzr(cmd)[0]
264
264
        # Check that we use the long status format
265
 
        self.assertNotContainsRe(log, '(?m)^A  hello.txt$')
266
 
        self.assertContainsRe(log, '(?m)^added:$')
 
265
        self.assertNotContainsRe(log, '(?m)^\s*A  hello.txt$')
 
266
        self.assertContainsRe(log, '(?m)^\s*added:$')
267
267
 
268
268
    def test_log_short_verbose(self):
269
269
        self.assertUseShortDeltaFormat(['log', '--short', '-v'])
298
298
        parent_tree.commit(message='merge branch 1')
299
299
        os.chdir('parent')
300
300
 
 
301
    def _prepare_short(self):
 
302
        parent_tree = self.make_branch_and_tree('parent')
 
303
        parent_tree.commit(message='first post',
 
304
            timestamp=1132586700, timezone=36000,
 
305
            committer='Joe Foo <joe@foo.com>')
 
306
        child_tree = parent_tree.bzrdir.sprout('child').open_workingtree()
 
307
        child_tree.commit(message='branch 1',
 
308
            timestamp=1132586800, timezone=36000,
 
309
            committer='Joe Foo <joe@foo.com>')
 
310
        smaller_tree = \
 
311
                child_tree.bzrdir.sprout('smallerchild').open_workingtree()
 
312
        smaller_tree.commit(message='branch 2',
 
313
            timestamp=1132586900, timezone=36000,
 
314
            committer='Joe Foo <joe@foo.com>')
 
315
        child_tree.merge_from_branch(smaller_tree.branch)
 
316
        child_tree.commit(message='merge branch 2',
 
317
            timestamp=1132587000, timezone=36000,
 
318
            committer='Joe Foo <joe@foo.com>')
 
319
        parent_tree.merge_from_branch(child_tree.branch)
 
320
        parent_tree.commit(message='merge branch 1',
 
321
            timestamp=1132587100, timezone=36000,
 
322
            committer='Joe Foo <joe@foo.com>')
 
323
        os.chdir('parent')
 
324
 
301
325
    def test_merges_are_indented_by_level(self):
302
326
        self._prepare()
303
327
        out,err = self.run_bzr('log')
341
365
  first post
342
366
""")
343
367
 
 
368
    def test_force_merge_revisions_off(self):
 
369
        self._prepare()
 
370
        out,err = self.run_bzr('log --long -n1')
 
371
        self.assertEqual('', err)
 
372
        log = normalize_log(out)
 
373
        self.assertEqualDiff(log, """\
 
374
------------------------------------------------------------
 
375
revno: 2
 
376
committer: Lorem Ipsum <test@example.com>
 
377
branch nick: parent
 
378
timestamp: Just now
 
379
message:
 
380
  merge branch 1
 
381
------------------------------------------------------------
 
382
revno: 1
 
383
committer: Lorem Ipsum <test@example.com>
 
384
branch nick: parent
 
385
timestamp: Just now
 
386
message:
 
387
  first post
 
388
""")
 
389
 
 
390
    def test_force_merge_revisions_on(self):
 
391
        self._prepare_short()
 
392
        out,err = self.run_bzr('log --short -n0')
 
393
        self.assertEqual('', err)
 
394
        log = normalize_log(out)
 
395
        self.assertEqualDiff(log, """\
 
396
    2 Joe Foo\t2005-11-22 [merge]
 
397
      merge branch 1
 
398
 
 
399
          1.1.2 Joe Foo\t2005-11-22 [merge]
 
400
                merge branch 2
 
401
 
 
402
              1.2.1 Joe Foo\t2005-11-22
 
403
                    branch 2
 
404
 
 
405
          1.1.1 Joe Foo\t2005-11-22
 
406
                branch 1
 
407
 
 
408
    1 Joe Foo\t2005-11-22
 
409
      first post
 
410
 
 
411
""")
 
412
 
 
413
    def test_force_merge_revisions_N(self):
 
414
        self._prepare_short()
 
415
        out,err = self.run_bzr('log --short -n2')
 
416
        self.assertEqual('', err)
 
417
        log = normalize_log(out)
 
418
        self.assertEqualDiff(log, """\
 
419
    2 Joe Foo\t2005-11-22 [merge]
 
420
      merge branch 1
 
421
 
 
422
          1.1.2 Joe Foo\t2005-11-22 [merge]
 
423
                merge branch 2
 
424
 
 
425
          1.1.1 Joe Foo\t2005-11-22
 
426
                branch 1
 
427
 
 
428
    1 Joe Foo\t2005-11-22
 
429
      first post
 
430
 
 
431
""")
 
432
 
344
433
    def test_merges_single_merge_rev(self):
345
434
        self._prepare()
346
435
        out,err = self.run_bzr('log -r1.1.2')