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

  • Committer: Jelmer Vernooij
  • Date: 2017-05-21 19:09:26 UTC
  • mfrom: (6622.1.36 breezy)
  • Revision ID: jelmer@jelmer.uk-20170521190926-5vtz8xaf0e9ylrpc
Merge rename to breezy.

Show diffs side-by-side

added added

removed removed

Lines of Context:
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
 
18
 
"""Black-box tests for bzr log."""
 
18
"""Black-box tests for brz log."""
19
19
 
20
20
from itertools import izip
21
21
import os
22
22
 
23
 
from bzrlib import (
 
23
from breezy import (
24
24
    branchbuilder,
25
25
    errors,
26
26
    log,
27
27
    osutils,
28
28
    tests,
29
29
    )
30
 
from bzrlib.tests import (
 
30
from breezy.tests import (
31
31
    test_log,
32
32
    features,
33
33
    )
34
 
from bzrlib.tests.matchers import ContainsNoVfsCalls
 
34
from breezy.tests.matchers import ContainsNoVfsCalls
35
35
 
36
36
 
37
37
class TestLog(tests.TestCaseWithTransport, test_log.TestLogMixin):
340
340
 
341
341
    def test_log_zero_revspec(self):
342
342
        self.make_minimal_branch()
343
 
        self.run_bzr_error(['bzr: ERROR: Logging revision 0 is invalid.'],
 
343
        self.run_bzr_error(['brz: ERROR: Logging revision 0 is invalid.'],
344
344
                           ['log', '-r0'])
345
345
 
346
346
    def test_log_zero_begin_revspec(self):
347
347
        self.make_linear_branch()
348
 
        self.run_bzr_error(['bzr: ERROR: Logging revision 0 is invalid.'],
 
348
        self.run_bzr_error(['brz: ERROR: Logging revision 0 is invalid.'],
349
349
                           ['log', '-r0..2'])
350
350
 
351
351
    def test_log_zero_end_revspec(self):
352
352
        self.make_linear_branch()
353
 
        self.run_bzr_error(['bzr: ERROR: Logging revision 0 is invalid.'],
 
353
        self.run_bzr_error(['brz: ERROR: Logging revision 0 is invalid.'],
354
354
                           ['log', '-r-2..0'])
355
355
 
356
356
    def test_log_nonexistent_revno(self):
357
357
        self.make_minimal_branch()
358
 
        self.run_bzr_error(["bzr: ERROR: Requested revision: '1234' "
 
358
        self.run_bzr_error(["brz: ERROR: Requested revision: '1234' "
359
359
                            "does not exist in branch:"],
360
360
                           ['log', '-r1234'])
361
361
 
362
362
    def test_log_nonexistent_dotted_revno(self):
363
363
        self.make_minimal_branch()
364
 
        self.run_bzr_error(["bzr: ERROR: Requested revision: '123.123' "
 
364
        self.run_bzr_error(["brz: ERROR: Requested revision: '123.123' "
365
365
                            "does not exist in branch:"],
366
366
                           ['log',  '-r123.123'])
367
367
 
368
368
    def test_log_change_nonexistent_revno(self):
369
369
        self.make_minimal_branch()
370
 
        self.run_bzr_error(["bzr: ERROR: Requested revision: '1234' "
 
370
        self.run_bzr_error(["brz: ERROR: Requested revision: '1234' "
371
371
                            "does not exist in branch:"],
372
372
                           ['log',  '-c1234'])
373
373
 
374
374
    def test_log_change_nonexistent_dotted_revno(self):
375
375
        self.make_minimal_branch()
376
 
        self.run_bzr_error(["bzr: ERROR: Requested revision: '123.123' "
 
376
        self.run_bzr_error(["brz: ERROR: Requested revision: '123.123' "
377
377
                            "does not exist in branch:"],
378
378
                           ['log', '-c123.123'])
379
379
 
380
380
    def test_log_change_single_revno_only(self):
381
381
        self.make_minimal_branch()
382
 
        self.run_bzr_error(['bzr: ERROR: Option --change does not'
 
382
        self.run_bzr_error(['brz: ERROR: Option --change does not'
383
383
                           ' accept revision ranges'],
384
384
                           ['log', '--change', '2..3'])
385
385
 
386
386
    def test_log_change_incompatible_with_revision(self):
387
 
        self.run_bzr_error(['bzr: ERROR: --revision and --change'
 
387
        self.run_bzr_error(['brz: ERROR: --revision and --change'
388
388
                           ' are mutually exclusive'],
389
389
                           ['log', '--change', '2', '--revision', '3'])
390
390
 
399
399
 
400
400
    def test_log_reversed_revspecs(self):
401
401
        self.make_linear_branch()
402
 
        self.run_bzr_error(('bzr: ERROR: Start revision must be older than '
 
402
        self.run_bzr_error(('brz: ERROR: Start revision must be older than '
403
403
                            'the end revision.\n',),
404
404
                           ['log', '-r3..1'])
405
405
 
406
406
    def test_log_reversed_dotted_revspecs(self):
407
407
        self.make_merged_branch()
408
 
        self.run_bzr_error(('bzr: ERROR: Start revision not found in '
 
408
        self.run_bzr_error(('brz: ERROR: Start revision not found in '
409
409
                            'history of end revision.\n',),
410
410
                           "log -r 1.1.1..1")
411
411
 
422
422
 
423
423
    def test_log_unsupported_timezone(self):
424
424
        self.make_linear_branch()
425
 
        self.run_bzr_error(['bzr: ERROR: Unsupported timezone format "foo", '
 
425
        self.run_bzr_error(['brz: ERROR: Unsupported timezone format "foo", '
426
426
                            'options are "utc", "original", "local".'],
427
427
                           ['log', '--timezone', 'foo'])
428
428
 
429
429
    def test_log_exclude_ancestry_no_range(self):
430
430
        self.make_linear_branch()
431
 
        self.run_bzr_error(['bzr: ERROR: --exclude-common-ancestry'
 
431
        self.run_bzr_error(['brz: ERROR: --exclude-common-ancestry'
432
432
                            ' requires -r with two revisions'],
433
433
                           ['log', '--exclude-common-ancestry'])
434
434
 
435
435
    def test_log_exclude_ancestry_single_revision(self):
436
436
        self.make_merged_branch()
437
 
        self.run_bzr_error(['bzr: ERROR: --exclude-common-ancestry'
 
437
        self.run_bzr_error(['brz: ERROR: --exclude-common-ancestry'
438
438
                            ' requires two different revisions'],
439
439
                           ['log', '--exclude-common-ancestry',
440
440
                            '-r1.1.1..1.1.1'])
565
565
 
566
566
    def test_include_merges(self):
567
567
        # Confirm --include-merges gives the same output as -n0
568
 
        msg = ("The option '--include-merges' to 'bzr log' "
569
 
               "has been deprecated in bzr 2.5. "
 
568
        msg = ("The option '--include-merges' to 'brz log' "
 
569
               "has been deprecated in brz 2.5. "
570
570
               "Please use '--include-merged' instead.\n")
571
571
        self.assertLogRevnos(['--include-merges'],
572
572
                             ['2', '1.1.2', '1.2.1', '1.1.1', '1'],
771
771
        self.overrideAttr(osutils, '_cached_user_encoding')
772
772
 
773
773
    def create_branch(self):
774
 
        bzr = self.run_bzr
775
 
        bzr('init')
 
774
        brz = self.run_bzr
 
775
        brz('init')
776
776
        self.build_tree_contents([('a', 'some stuff\n')])
777
 
        bzr('add a')
778
 
        bzr(['commit', '-m', self._message])
 
777
        brz('add a')
 
778
        brz(['commit', '-m', self._message])
779
779
 
780
780
    def try_encoding(self, encoding, fail=False):
781
 
        bzr = self.run_bzr
 
781
        brz = self.run_bzr
782
782
        if fail:
783
783
            self.assertRaises(UnicodeEncodeError,
784
784
                self._mu.encode, encoding)
788
788
 
789
789
        old_encoding = osutils._cached_user_encoding
790
790
        # This test requires that 'run_bzr' uses the current
791
 
        # bzrlib, because we override user_encoding, and expect
 
791
        # breezy, because we override user_encoding, and expect
792
792
        # it to be used
793
793
        try:
794
794
            osutils._cached_user_encoding = 'ascii'
795
795
            # We should be able to handle any encoding
796
 
            out, err = bzr('log', encoding=encoding)
 
796
            out, err = brz('log', encoding=encoding)
797
797
            if not fail:
798
798
                # Make sure we wrote mu as we expected it to exist
799
799
                self.assertNotEqual(-1, out.find(encoded_msg))
817
817
            self.try_encoding(encoding, fail=True)
818
818
 
819
819
    def test_stdout_encoding(self):
820
 
        bzr = self.run_bzr
 
820
        brz = self.run_bzr
821
821
        osutils._cached_user_encoding = "cp1251"
822
822
 
823
 
        bzr('init')
 
823
        brz('init')
824
824
        self.build_tree(['a'])
825
 
        bzr('add a')
826
 
        bzr(['commit', '-m', u'\u0422\u0435\u0441\u0442'])
 
825
        brz('add a')
 
826
        brz(['commit', '-m', u'\u0422\u0435\u0441\u0442'])
827
827
        stdout, stderr = self.run_bzr('log', encoding='cp866')
828
828
 
829
829
        message = stdout.splitlines()[-1]
1018
1018
        (stdout, stderr) = self.run_bzr(['log', '-r..2'], retcode=3)
1019
1019
        self.assertEqual(["2", "1"],
1020
1020
                         [r.revno for r in self.get_captured_revisions()])
1021
 
        self.assertEqual("bzr: ERROR: Further revision history missing.", stderr)
 
1021
        self.assertEqual("brz: ERROR: Further revision history missing.", stderr)
1022
1022
 
1023
1023
    def test_log_range_open_end(self):
1024
1024
        self.assertLogRevnos(["-r1.."], ["2", "1"])