~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_annotate.py

  • Committer: wang
  • Date: 2006-10-29 13:41:32 UTC
  • mto: (2104.4.1 wang_65714)
  • mto: This revision was merged to the branch mainline in revision 2109.
  • Revision ID: wang@ubuntu-20061029134132-3d7f4216f20c4aef
Replace python's difflib by patiencediff because the worst case 
performance is cubic for difflib and people commiting large data 
files are often hurt by this. The worst case performance of patience is 
quadratic. Fix bug 65714.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2005 by Canonical Ltd
 
1
# Copyright (C) 2005 Canonical Ltd
2
2
# -*- coding: utf-8 -*-
3
3
#
4
4
# This program is free software; you can redistribute it and/or modify
71
71
''')
72
72
 
73
73
    def test_annotate_cmd_revision(self):
74
 
        out, err = self.run_bzr_captured(['annotate', 'hello.txt', '-r 1'])
 
74
        out, err = self.run_bzr_captured(['annotate', 'hello.txt', '-r1'])
75
75
        self.assertEquals(err, '')
76
76
        self.assertEqualDiff(out, '''\
77
77
    1 test@us | my helicopter
78
78
''')
79
79
 
80
80
    def test_annotate_cmd_revision3(self):
81
 
        out, err = self.run_bzr_captured(['annotate', 'hello.txt', '-r 3'])
 
81
        out, err = self.run_bzr_captured(['annotate', 'hello.txt', '-r3'])
82
82
        self.assertEquals(err, '')
83
83
        self.assertEqualDiff(out, '''\
84
84
    1 test@us | my helicopter
86
86
''')
87
87
 
88
88
    def test_annotate_cmd_unknown_revision(self):
89
 
        out, err = self.run_bzr_captured(['annotate', 'hello.txt', '-r 10'],
 
89
        out, err = self.run_bzr_captured(['annotate', 'hello.txt', '-r', '10'],
90
90
                                         retcode=3)
91
91
        self.assertEquals(out, '')
92
 
        self.assertContainsRe(err, 'has no revision 10')
 
92
        self.assertContainsRe(err, 'Requested revision: \'10\' does not exist')
93
93
 
94
94
    def test_annotate_cmd_two_revisions(self):
95
 
        out, err = self.run_bzr_captured(['annotate', 'hello.txt', '-r 1..2'],
 
95
        out, err = self.run_bzr_captured(['annotate', 'hello.txt', '-r1..2'],
96
96
                                         retcode=3)
97
97
        self.assertEquals(out, '')
98
98
        self.assertEquals(err, 'bzr: ERROR: bzr annotate --revision takes'
99
99
                               ' exactly 1 argument\n')
 
100
 
 
101
    def test_annotate_empty_file(self):
 
102
        tree = self.make_branch_and_tree('tree')
 
103
        self.build_tree_contents([('tree/empty', '')])
 
104
        tree.add('empty')
 
105
        tree.commit('add empty file')
 
106
 
 
107
        os.chdir('tree')
 
108
        out, err = self.run_bzr('annotate', 'empty')
 
109
        self.assertEqual('', out)