~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Jelmer Vernooij
  • Date: 2016-04-03 16:32:31 UTC
  • mto: This revision was merged to the branch mainline in revision 6617.
  • Revision ID: jelmer@jelmer.uk-20160403163231-h72bo0uyek2gikw0
Don't put French text in doc/en/user-reference when LANGUAGE=fr_CH.UTF_8.

Show diffs side-by-side

added added

removed removed

Lines of Context:
29
29
    tests,
30
30
    )
31
31
 
 
32
from bzrlib.tests.matchers import ContainsNoVfsCalls
32
33
from bzrlib.urlutils import joinpath
33
34
 
34
35
 
177
178
 
178
179
    def test_annotate_edited_file(self):
179
180
        tree = self._setup_edited_file()
180
 
        tree.branch.get_config().set_user_option('email', 'current@host2')
 
181
        self.overrideEnv('BZR_EMAIL', 'current@host2')
181
182
        out, err = self.run_bzr('annotate file')
182
183
        self.assertEqual(
183
184
            '1   test@ho | foo\n'
202
203
 
203
204
    def test_annotate_edited_file_show_ids(self):
204
205
        tree = self._setup_edited_file()
205
 
        tree.branch.get_config().set_user_option('email', 'current@host2')
 
206
        self.overrideEnv('BZR_EMAIL', 'current@host2')
206
207
        out, err = self.run_bzr('annotate file --show-ids')
207
208
        self.assertEqual(
208
209
            '    rev1 | foo\n'
232
233
    def test_annotated_edited_merged_file_revnos(self):
233
234
        wt = self._create_merged_file()
234
235
        out, err = self.run_bzr(['annotate', 'file'])
235
 
        email = config.extract_email_address(wt.branch.get_config().username())
 
236
        email = config.extract_email_address(
 
237
            wt.branch.get_config_stack().get('email'))
236
238
        self.assertEqual(
237
239
            '3?    %-7s | local\n'
238
240
            '1     test@ho | foo\n'
307
309
        wt.commit('commit', committer='test@user')
308
310
        out, err = self.run_bzr(['annotate', '-d', 'a', 'hello.txt'])
309
311
        self.assertEqualDiff('1   test@us | my helicopter\n', out)
 
312
 
 
313
 
 
314
class TestSmartServerAnnotate(tests.TestCaseWithTransport):
 
315
 
 
316
    def test_simple_annotate(self):
 
317
        self.setup_smart_server_with_call_log()
 
318
        wt = self.make_branch_and_tree('branch')
 
319
        self.build_tree_contents([('branch/hello.txt', 'my helicopter\n')])
 
320
        wt.add(['hello.txt'])
 
321
        wt.commit('commit', committer='test@user')
 
322
        self.reset_smart_call_log()
 
323
        out, err = self.run_bzr(['annotate', "-d", self.get_url('branch'),
 
324
            "hello.txt"])
 
325
        # This figure represent the amount of work to perform this use case. It
 
326
        # is entirely ok to reduce this number if a test fails due to rpc_count
 
327
        # being too low. If rpc_count increases, more network roundtrips have
 
328
        # become necessary for this use case. Please do not adjust this number
 
329
        # upwards without agreement from bzr's network support maintainers.
 
330
        self.assertLength(16, self.hpss_calls)
 
331
        self.assertLength(1, self.hpss_connections)
 
332
        self.expectFailure("annotate accesses inventories, which require VFS access",
 
333
            self.assertThat, self.hpss_calls, ContainsNoVfsCalls)