~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

(gz) Fix test failure on alpha by correcting format string for
 gc_chk_sha1_record (Martin [gz])

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
"""
25
25
 
26
26
 
27
 
from bzrlib import (
28
 
    config,
29
 
    tests,
30
 
    )
 
27
from bzrlib import tests
31
28
 
 
29
from bzrlib.config import extract_email_address
32
30
from bzrlib.urlutils import joinpath
33
31
 
34
32
 
162
160
        tree.add('file')
163
161
        tree.commit('add file', committer="test@host", rev_id="rev1")
164
162
        self.build_tree_contents([(file_relpath, 'foo\nbar\ngam\n')])
 
163
        tree.branch.get_config().set_user_option('email', 'current@host2')
165
164
        return tree
166
165
 
167
166
    def test_annotate_cmd_revspec_branch(self):
177
176
 
178
177
    def test_annotate_edited_file(self):
179
178
        tree = self._setup_edited_file()
180
 
        tree.branch.get_config().set_user_option('email', 'current@host2')
181
179
        out, err = self.run_bzr('annotate file')
182
180
        self.assertEqual(
183
181
            '1   test@ho | foo\n'
185
183
            '1   test@ho | gam\n',
186
184
            out)
187
185
 
188
 
    def test_annotate_edited_file_no_default(self):
189
 
        # Ensure that when no username is available annotate still works.
190
 
        self.overrideEnv('EMAIL', None)
191
 
        self.overrideEnv('BZR_EMAIL', None)
192
 
        # Also, make sure that it's not inferred from mailname.
193
 
        self.overrideAttr(config, '_auto_user_id',
194
 
            lambda: (None, None))
195
 
        tree = self._setup_edited_file()
196
 
        out, err = self.run_bzr('annotate file')
197
 
        self.assertEqual(
198
 
            '1   test@ho | foo\n'
199
 
            '2?  local u | bar\n'
200
 
            '1   test@ho | gam\n',
201
 
            out)
202
 
 
203
186
    def test_annotate_edited_file_show_ids(self):
204
187
        tree = self._setup_edited_file()
205
 
        tree.branch.get_config().set_user_option('email', 'current@host2')
206
188
        out, err = self.run_bzr('annotate file --show-ids')
207
189
        self.assertEqual(
208
190
            '    rev1 | foo\n'
232
214
    def test_annotated_edited_merged_file_revnos(self):
233
215
        wt = self._create_merged_file()
234
216
        out, err = self.run_bzr(['annotate', 'file'])
235
 
        email = config.extract_email_address(wt.branch.get_config().username())
 
217
        email = extract_email_address(wt.branch.get_config().username())
236
218
        self.assertEqual(
237
219
            '3?    %-7s | local\n'
238
220
            '1     test@ho | foo\n'