240
239
return diff.DiffFromTool.from_string(cmd, old_tree, new_tree,
243
def get_mail_client(self):
244
"""Get a mail client to use"""
245
selected_client = self.get_user_option('mail_client')
246
_registry = mail_client.mail_client_registry
248
mail_client_class = _registry.get(selected_client)
250
raise errors.UnknownMailClient(selected_client)
251
return mail_client_class(self)
253
242
def _get_signature_checking(self):
254
243
"""Template method to override signature checking policy."""
1526
1515
def config_dir():
1527
"""Return per-user configuration directory.
1516
"""Return per-user configuration directory as unicode string
1529
1518
By default this is %APPDATA%/bazaar/2.0 on Windows, ~/.bazaar on Mac OS X
1530
1519
and Linux. On Linux, if there is a $XDG_CONFIG_HOME/bazaar directory,
1533
1522
TODO: Global option --config-dir to override this.
1535
base = os.environ.get('BZR_HOME', None)
1524
base = osutils.path_from_environ('BZR_HOME')
1536
1525
if sys.platform == 'win32':
1537
# environ variables on Windows are in user encoding/mbcs. So decode
1539
if base is not None:
1540
base = base.decode('mbcs')
1542
base = win32utils.get_appdata_location_unicode()
1544
base = os.environ.get('HOME', None)
1545
if base is not None:
1546
base = base.decode('mbcs')
1548
raise errors.BzrError('You must have one of BZR_HOME, APPDATA,'
1527
base = win32utils.get_appdata_location()
1529
base = win32utils.get_home_location()
1530
# GZ 2012-02-01: Really the two level subdirs only make sense inside
1531
# APPDATA, but hard to move. See bug 348640 for more.
1550
1532
return osutils.pathjoin(base, 'bazaar', '2.0')
1552
if base is not None:
1553
base = base.decode(osutils._fs_enc)
1554
if sys.platform == 'darwin':
1556
# this takes into account $HOME
1557
base = os.path.expanduser("~")
1558
return osutils.pathjoin(base, '.bazaar')
1561
xdg_dir = os.environ.get('XDG_CONFIG_HOME', None)
1534
# GZ 2012-02-01: What should OSX use instead of XDG if anything?
1535
if sys.platform != 'darwin':
1536
xdg_dir = osutils.path_from_environ('XDG_CONFIG_HOME')
1562
1537
if xdg_dir is None:
1563
xdg_dir = osutils.pathjoin(os.path.expanduser("~"), ".config")
1538
xdg_dir = osutils.pathjoin(osutils._get_home_dir(), ".config")
1564
1539
xdg_dir = osutils.pathjoin(xdg_dir, 'bazaar')
1565
1540
if osutils.isdir(xdg_dir):
1567
1542
"Using configuration in XDG directory %s." % xdg_dir)
1569
base = os.path.expanduser("~")
1570
return osutils.pathjoin(base, ".bazaar")
1544
base = osutils._get_home_dir()
1545
return osutils.pathjoin(base, ".bazaar")
1573
1548
def config_filename():
2803
2778
Standard log formats are ``long``, ``short`` and ``line``. Additional formats
2804
2779
may be provided by plugins.
2781
option_registry.register_lazy('mail_client', 'bzrlib.mail_client',
2806
2783
option_registry.register(
2807
2784
Option('output_encoding',
2808
2785
help= 'Unicode encoding for output'
2909
2886
ListOption('suppress_warnings',
2911
2888
help="List of warning classes to suppress."))
2889
option_registry.register(
2890
Option('validate_signatures_in_log', default=False,
2891
from_unicode=bool_from_store, invalid='warning',
2892
help='''Whether to validate signatures in bzr log.'''))
2912
2893
option_registry.register_lazy('ssl.ca_certs',
2913
2894
'bzrlib.transport.http._urllib2_wrappers', 'opt_ssl_ca_certs')