~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_config.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-01-25 13:59:32 UTC
  • mfrom: (5321.1.119 mergetools)
  • Revision ID: pqm@pqm.ubuntu.com-20110125135932-0o8d07i3j1flp6ou
(vila) Added external merge tool management module,
 bzrlib.mergetools. (Gordon Tyler)

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
    errors,
34
34
    osutils,
35
35
    mail_client,
 
36
    mergetools,
36
37
    ui,
37
38
    urlutils,
38
39
    tests,
70
71
gpg_signing_command=gnome-gpg
71
72
log_format=short
72
73
user_global_option=something
 
74
bzr.mergetool.sometool=sometool {base} {this} {other} -o {result}
 
75
bzr.mergetool.funkytool=funkytool "arg with spaces" {this_temp}
 
76
bzr.default_mergetool=sometool
73
77
[ALIASES]
74
78
h=help
75
79
ll=""" + sample_long_alias + "\n"
953
957
        change_editor = my_config.get_change_editor('old', 'new')
954
958
        self.assertIs(None, change_editor)
955
959
 
 
960
    def test_get_merge_tools(self):
 
961
        conf = self._get_sample_config()
 
962
        tools = conf.get_merge_tools()
 
963
        self.log(repr(tools))
 
964
        self.assertEqual(
 
965
            {u'funkytool' : u'funkytool "arg with spaces" {this_temp}',
 
966
            u'sometool' : u'sometool {base} {this} {other} -o {result}'},
 
967
            tools)
 
968
 
 
969
    def test_get_merge_tools_empty(self):
 
970
        conf = self._get_empty_config()
 
971
        tools = conf.get_merge_tools()
 
972
        self.assertEqual({}, tools)
 
973
 
 
974
    def test_find_merge_tool(self):
 
975
        conf = self._get_sample_config()
 
976
        cmdline = conf.find_merge_tool('sometool')
 
977
        self.assertEqual('sometool {base} {this} {other} -o {result}', cmdline)
 
978
 
 
979
    def test_find_merge_tool_not_found(self):
 
980
        conf = self._get_sample_config()
 
981
        cmdline = conf.find_merge_tool('DOES NOT EXIST')
 
982
        self.assertIs(cmdline, None)
 
983
 
 
984
    def test_find_merge_tool_known(self):
 
985
        conf = self._get_empty_config()
 
986
        cmdline = conf.find_merge_tool('kdiff3')
 
987
        self.assertEquals('kdiff3 {base} {this} {other} -o {result}', cmdline)
 
988
        
 
989
    def test_find_merge_tool_override_known(self):
 
990
        conf = self._get_empty_config()
 
991
        conf.set_user_option('bzr.mergetool.kdiff3', 'kdiff3 blah')
 
992
        cmdline = conf.find_merge_tool('kdiff3')
 
993
        self.assertEqual('kdiff3 blah', cmdline)
 
994
 
956
995
 
957
996
class TestGlobalConfigSavingOptions(tests.TestCaseInTempDir):
958
997