1
# Copyright (C) 2005 by Canonical Ltd
3
# This program is free software; you can redistribute it and/or modify
4
# it under the terms of the GNU General Public License version 2 as published by
5
# the Free Software Foundation.
7
# This program is distributed in the hope that it will be useful,
8
# but WITHOUT ANY WARRANTY; without even the implied warranty of
9
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10
# GNU General Public License for more details.
12
# You should have received a copy of the GNU General Public License
13
# along with this program; if not, write to the Free Software
14
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16
"""Test commit message editor.
22
from bzrlib.branch import Branch
23
from bzrlib.msgeditor import make_commit_message_template
24
from bzrlib.tests import TestCaseInTempDir, TestSkipped
27
class MsgEditorTest(TestCaseInTempDir):
29
def make_uncommitted_tree(self):
30
"""Build a branch with uncommitted unicode named changes in the cwd."""
31
b = Branch.initialize('.')
32
working_tree = b.working_tree()
33
filename = u'hell\u00d8'
35
self.build_tree_contents([(filename, 'contents of hello')])
36
except UnicodeEncodeError:
37
raise TestSkipped("can't build unicode working tree in "
38
"filesystem encoding %s" % sys.getfilesystemencoding())
39
working_tree.add(filename)
42
def test_commit_template(self):
43
"""Test building a commit message template"""
44
working_tree = self.make_uncommitted_tree()
45
template = make_commit_message_template(working_tree, None)
46
self.assertEqualDiff(template,