~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: 2009-11-12 08:40:21 UTC
  • mfrom: (4603.1.26 shelve-editor)
  • Revision ID: pqm@pqm.ubuntu.com-20091112084021-z1abucfx1bwampnq
(abentley) add support for shelving with an editor.

Show diffs side-by-side

added added

removed removed

Lines of Context:
25
25
    branch,
26
26
    bzrdir,
27
27
    config,
 
28
    diff,
28
29
    errors,
29
30
    osutils,
30
31
    mail_client,
42
43
[DEFAULT]
43
44
email=Erik B\u00e5gfors <erik@bagfors.nu>
44
45
editor=vim
 
46
change_editor=vimdiff -of @new_path @old_path
45
47
gpg_signing_command=gnome-gpg
46
48
log_format=short
47
49
user_global_option=something
208
210
        self._calls.append('_get_signature_checking')
209
211
        return self._signatures
210
212
 
 
213
    def _get_change_editor(self):
 
214
        self._calls.append('_get_change_editor')
 
215
        return 'vimdiff -fo @new_path @old_path'
 
216
 
211
217
 
212
218
bool_config = """[DEFAULT]
213
219
active = true
314
320
        my_config = config.Config()
315
321
        self.assertEqual('long', my_config.log_format())
316
322
 
 
323
    def test_get_change_editor(self):
 
324
        my_config = InstrumentedConfig()
 
325
        change_editor = my_config.get_change_editor('old_tree', 'new_tree')
 
326
        self.assertEqual(['_get_change_editor'], my_config._calls)
 
327
        self.assertIs(diff.DiffFromTool, change_editor.__class__)
 
328
        self.assertEqual(['vimdiff', '-fo', '@new_path', '@old_path'],
 
329
                         change_editor.command_template)
 
330
 
317
331
 
318
332
class TestConfigPath(tests.TestCase):
319
333
 
625
639
        my_config = self._get_sample_config()
626
640
        self.assertEqual(sample_long_alias, my_config.get_alias('ll'))
627
641
 
 
642
    def test_get_change_editor(self):
 
643
        my_config = self._get_sample_config()
 
644
        change_editor = my_config.get_change_editor('old', 'new')
 
645
        self.assertIs(diff.DiffFromTool, change_editor.__class__)
 
646
        self.assertEqual('vimdiff -of @new_path @old_path',
 
647
                         ' '.join(change_editor.command_template))
 
648
 
 
649
    def test_get_no_change_editor(self):
 
650
        my_config = self._get_empty_config()
 
651
        change_editor = my_config.get_change_editor('old', 'new')
 
652
        self.assertIs(None, change_editor)
 
653
 
628
654
 
629
655
class TestGlobalConfigSavingOptions(tests.TestCaseInTempDir):
630
656