/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to breezy/__main__.py

  • Committer: Jelmer Vernooij
  • Date: 2018-02-18 21:42:57 UTC
  • mto: This revision was merged to the branch mainline in revision 6859.
  • Revision ID: jelmer@jelmer.uk-20180218214257-jpevutp1wa30tz3v
Update TODO to reference Breezy, not Bazaar.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#! /usr/bin/env python3
2
 
 
3
 
# Copyright (C) 2005-2013, 2016, 2017 Canonical Ltd
4
 
# Copyright (C) 2018-2020 Breezy Developers
5
 
#
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.
10
 
#
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.
15
 
#
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
19
 
 
20
 
from __future__ import absolute_import
21
 
 
22
 
"""Breezy -- a free distributed version-control tool"""
23
 
 
24
 
import os
25
 
import sys
26
 
import warnings
27
 
 
28
 
 
29
 
profiling = False
30
 
if '--profile-imports' in sys.argv:
31
 
    import profile_imports
32
 
    profile_imports.install()
33
 
    profiling = True
34
 
 
35
 
 
36
 
if os.name == "posix":
37
 
    import locale
38
 
    try:
39
 
        locale.setlocale(locale.LC_ALL, '')
40
 
    except locale.Error as e:
41
 
        sys.stderr.write(
42
 
            'brz: warning: %s\n'
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"
51
 
 
52
 
 
53
 
def main():
54
 
    import breezy.breakin
55
 
    breezy.breakin.hook_debugger_to_signal()
56
 
 
57
 
    import breezy.commands
58
 
    import breezy.trace
59
 
 
60
 
    with breezy.initialize():
61
 
        exit_val = breezy.commands.main()
62
 
        if profiling:
63
 
            profile_imports.log_stack_info(sys.stderr)
64
 
 
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:
74
 
        exitfunc()
75
 
    os._exit(exit_val)
76
 
 
77
 
 
78
 
if __name__ == '__main__':
79
 
    main()