~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzr

  • Committer: Vincent Ladeuil
  • Date: 2010-06-23 08:19:28 UTC
  • mfrom: (5317 +trunk)
  • mto: (5247.1.11 first-try)
  • mto: This revision was merged to the branch mainline in revision 5326.
  • Revision ID: v.ladeuil+lp@free.fr-20100623081928-z9q18q30oo5as831
Merge bzr.dev into cleanup

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
 
53
53
profiling = False
54
54
if '--profile-imports' in sys.argv:
55
 
    sys.argv.remove('--profile-imports')
56
55
    import profile_imports
57
56
    profile_imports.install()
58
57
    profiling = True
135
134
 
136
135
 
137
136
if __name__ == '__main__':
138
 
    bzrlib.initialize()
139
 
    exit_val = bzrlib.commands.main()
140
 
 
141
 
    if profiling:
142
 
        profile_imports.log_stack_info(sys.stderr)
 
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)
143
145
 
144
146
    # By this point we really have completed everything we want to do, and
145
147
    # there's no point doing any additional cleanup.  Abruptly exiting here