1
#! /usr/bin/env python3
3
# Copyright (C) 2005-2013, 2016, 2017 Canonical Ltd
4
# Copyright (C) 2018-2020 Breezy Developers
6
# This program is free software; you can redistribute it and/or modify
7
# it under the terms of the GNU General Public License as published by
8
# the Free Software Foundation; either version 2 of the License, or
9
# (at your option) any later version.
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU General Public License for more details.
16
# You should have received a copy of the GNU General Public License
17
# along with this program; if not, write to the Free Software
18
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20
from __future__ import absolute_import
22
"""Breezy -- a free distributed version-control tool"""
30
if '--profile-imports' in sys.argv:
31
import profile_imports
32
profile_imports.install()
36
if os.name == "posix":
39
locale.setlocale(locale.LC_ALL, '')
40
except locale.Error as e:
43
' bzr could not set the application locale.\n'
44
' Although this should be no problem for bzr itself, it might\n'
45
' cause problems with some plugins. To investigate the issue,\n'
46
' look at the output of the locale(1p) tool.\n' % e)
47
# Use better default than ascii with posix filesystems that deal in bytes
48
# natively even when the C locale or no locale at all is given. Note that
49
# we need an immortal string for the hack, hence the lack of a hyphen.
50
sys._brz_default_fs_enc = "utf8"
55
breezy.breakin.hook_debugger_to_signal()
57
import breezy.commands
60
with breezy.initialize():
61
exit_val = breezy.commands.main()
63
profile_imports.log_stack_info(sys.stderr)
65
# By this point we really have completed everything we want to do, and
66
# there's no point doing any additional cleanup. Abruptly exiting here
67
# stops any background threads getting into trouble as code is unloaded,
68
# and it may also be slightly faster, through avoiding gc of objects that
69
# are just about to be discarded anyhow. This does mean that atexit hooks
70
# won't run but we don't use them. Also file buffers won't be flushed,
71
# but our policy is to always close files from a finally block. -- mbp 20070215
72
exitfunc = getattr(sys, "exitfunc", None)
73
if exitfunc is not None:
78
if __name__ == '__main__':