~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_msgeditor.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:
1
 
# Copyright (C) 2005-2011 Canonical Ltd
 
1
# Copyright (C) 2005-2012, 2016 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
26
26
    errors,
27
27
    msgeditor,
28
28
    osutils,
29
 
    tests,
30
29
    trace,
31
30
    )
32
31
from bzrlib.msgeditor import (
34
33
    edit_commit_message_encoded
35
34
)
36
35
from bzrlib.tests import (
 
36
    features,
37
37
    TestCaseInTempDir,
38
38
    TestCaseWithTransport,
39
39
    TestNotApplicable,
80
80
""")
81
81
 
82
82
    def make_multiple_pending_tree(self):
83
 
        from bzrlib import config
84
 
        config.GlobalConfig().set_user_option('email',
85
 
                                              'Bilbo Baggins <bb@hobbit.net>')
 
83
        config.GlobalStack().set('email', 'Bilbo Baggins <bb@hobbit.net>')
86
84
        tree = self.make_branch_and_tree('a')
87
85
        tree.commit('Initial checkin.', timestamp=1230912900, timezone=0)
88
86
        tree2 = tree.bzrdir.clone('b').open_workingtree()
251
249
        self.overrideEnv('VISUAL', 'visual')
252
250
        self.overrideEnv('EDITOR', 'editor')
253
251
 
254
 
        conf = config.GlobalConfig.from_string('editor = config_editor\n',
255
 
                                               save=True)
256
 
 
 
252
        conf = config.GlobalStack()
 
253
        conf.store._load_from_string('[DEFAULT]\neditor = config_editor\n')
 
254
        conf.store.save()
257
255
        editors = list(msgeditor._get_editor())
258
256
        editors = [editor for (editor, cfg_src) in editors]
259
257
 
309
307
        self.assertFileEqual(expected, msgfilename)
310
308
 
311
309
    def test__create_temp_file_with_commit_template_in_unicode_dir(self):
312
 
        self.requireFeature(tests.UnicodeFilenameFeature)
 
310
        self.requireFeature(features.UnicodeFilenameFeature)
313
311
        if hasattr(self, 'info'):
314
312
            tmpdir = self.info['directory']
315
313
            os.mkdir(tmpdir)
353
351
        msgeditor.hooks.install_named_hook("set_commit_message",
354
352
                lambda commit_obj, existing_message: "save me some typing\n", None)
355
353
        commit_obj = commit.Commit()
356
 
        self.assertEquals("save me some typing\n",
 
354
        self.assertEqual("save me some typing\n",
357
355
            msgeditor.set_commit_message(commit_obj))
358
356
 
359
357
    def test_generate_commit_message_template_no_hooks(self):
365
363
        msgeditor.hooks.install_named_hook("commit_message_template",
366
364
                lambda commit_obj, msg: "save me some typing\n", None)
367
365
        commit_obj = commit.Commit()
368
 
        self.assertEquals("save me some typing\n",
 
366
        self.assertEqual("save me some typing\n",
369
367
            msgeditor.generate_commit_message_template(commit_obj))
370
368
 
371
369