~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzr

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2010-09-01 08:02:42 UTC
  • mfrom: (5390.3.3 faster-revert-593560)
  • Revision ID: pqm@pqm.ubuntu.com-20100901080242-esg62ody4frwmy66
(spiv) Avoid repeatedly calling self.target.all_file_ids() in
 InterTree.iter_changes. (Andrew Bennetts)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#! /usr/bin/env python
2
2
 
3
 
# Copyright (C) 2005, 2006, 2007, 2008, 2009 Canonical Ltd
 
3
# Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010 Canonical Ltd
4
4
#
5
5
# This program is free software; you can redistribute it and/or modify
6
6
# it under the terms of the GNU General Public License as published by
23
23
import warnings
24
24
 
25
25
# update this on each release
26
 
_script_version = (1, 18, 0)
 
26
_script_version = (2, 3, 0)
27
27
 
28
 
if __doc__ is None:
29
 
    print "bzr does not support python -OO."
30
 
    sys.exit(2)
31
28
try:
32
29
    version_info = sys.version_info
33
30
except AttributeError:
55
52
 
56
53
profiling = False
57
54
if '--profile-imports' in sys.argv:
58
 
    sys.argv.remove('--profile-imports')
59
55
    import profile_imports
60
56
    profile_imports.install()
61
57
    profiling = True
122
118
bzrlib.inspect_for_copy.import_copy_with_hacked_inspect()
123
119
 
124
120
import bzrlib.breakin
125
 
bzrlib.breakin.hook_sigquit()
 
121
bzrlib.breakin.hook_debugger_to_signal()
126
122
 
127
123
import bzrlib.decorators
128
124
if ('--lsprof' in sys.argv
138
134
 
139
135
 
140
136
if __name__ == '__main__':
141
 
    bzrlib.trace.enable_default_logging()
142
 
    exit_val = bzrlib.commands.main()
143
 
 
144
 
    if profiling:
145
 
        profile_imports.log_stack_info(sys.stderr)
146
 
 
147
 
    # run anything registered by atexit, because it won't be run in the normal
148
 
    # way
149
 
    sys.exitfunc()
 
137
    library_state = bzrlib.initialize()
 
138
    library_state.__enter__()
 
139
    try:
 
140
        exit_val = bzrlib.commands.main()
 
141
        if profiling:
 
142
            profile_imports.log_stack_info(sys.stderr)
 
143
    finally:
 
144
        library_state.__exit__(None, None, None)
150
145
 
151
146
    # By this point we really have completed everything we want to do, and
152
147
    # there's no point doing any additional cleanup.  Abruptly exiting here
155
150
    # are just about to be discarded anyhow.  This does mean that atexit hooks
156
151
    # won't run but we don't use them.  Also file buffers won't be flushed,
157
152
    # but our policy is to always close files from a finally block. -- mbp 20070215
158
 
    try:
159
 
        sys.stdout.flush()
160
 
        sys.stderr.flush()
161
 
    except IOError, e:
162
 
        import errno
163
 
        if e.errno in [errno.EINVAL, errno.EPIPE]:
164
 
            pass
165
 
        else:
166
 
            raise
167
 
    if bzrlib.trace._trace_file:
168
 
        # this is also _bzr_log
169
 
        bzrlib.trace._trace_file.flush()
 
153
    sys.exitfunc()
170
154
    os._exit(exit_val)
171
155
else:
172
156
    raise ImportError("The bzr script cannot be imported.")