~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_msgeditor.py

  • Committer: Patch Queue Manager
  • Date: 2016-02-01 19:13:13 UTC
  • mfrom: (6614.2.2 trunk)
  • Revision ID: pqm@pqm.ubuntu.com-20160201191313-wdfvmfff1djde6oq
(vila) Release 2.7.0 (Vincent Ladeuil)

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 (
81
80
""")
82
81
 
83
82
    def make_multiple_pending_tree(self):
84
 
        from bzrlib import config
85
 
        config.GlobalConfig().set_user_option('email',
86
 
                                              'Bilbo Baggins <bb@hobbit.net>')
 
83
        config.GlobalStack().set('email', 'Bilbo Baggins <bb@hobbit.net>')
87
84
        tree = self.make_branch_and_tree('a')
88
85
        tree.commit('Initial checkin.', timestamp=1230912900, timezone=0)
89
86
        tree2 = tree.bzrdir.clone('b').open_workingtree()
252
249
        self.overrideEnv('VISUAL', 'visual')
253
250
        self.overrideEnv('EDITOR', 'editor')
254
251
 
255
 
        conf = config.GlobalConfig.from_string('editor = config_editor\n',
256
 
                                               save=True)
257
 
 
 
252
        conf = config.GlobalStack()
 
253
        conf.store._load_from_string('[DEFAULT]\neditor = config_editor\n')
 
254
        conf.store.save()
258
255
        editors = list(msgeditor._get_editor())
259
256
        editors = [editor for (editor, cfg_src) in editors]
260
257
 
354
351
        msgeditor.hooks.install_named_hook("set_commit_message",
355
352
                lambda commit_obj, existing_message: "save me some typing\n", None)
356
353
        commit_obj = commit.Commit()
357
 
        self.assertEquals("save me some typing\n",
 
354
        self.assertEqual("save me some typing\n",
358
355
            msgeditor.set_commit_message(commit_obj))
359
356
 
360
357
    def test_generate_commit_message_template_no_hooks(self):
366
363
        msgeditor.hooks.install_named_hook("commit_message_template",
367
364
                lambda commit_obj, msg: "save me some typing\n", None)
368
365
        commit_obj = commit.Commit()
369
 
        self.assertEquals("save me some typing\n",
 
366
        self.assertEqual("save me some typing\n",
370
367
            msgeditor.generate_commit_message_template(commit_obj))
371
368
 
372
369