~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_msgeditor.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-08-17 18:13:57 UTC
  • mfrom: (5268.7.29 transport-segments)
  • Revision ID: pqm@pqm.ubuntu.com-20110817181357-y5q5eth1hk8bl3om
(jelmer) Allow specifying the colocated branch to use in the branch URL,
 and retrieving the branch name using ControlDir._get_selected_branch.
 (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

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