← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~mwhudson/launchpad/initialize-bzrlib-in-ec2-bug-624434 into lp:launchpad/devel

 

Michael Hudson has proposed merging lp:~mwhudson/launchpad/initialize-bzrlib-in-ec2-bug-624434 into lp:launchpad/devel.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)
Related bugs:
  #624434 ec2 needs to initialize bzrlib
  https://bugs.launchpad.net/bugs/624434


Hi, as per the bug report, bin/ec2 need to call bzrlib.initialize() now.
-- 
https://code.launchpad.net/~mwhudson/launchpad/initialize-bzrlib-in-ec2-bug-624434/+merge/33730
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~mwhudson/launchpad/initialize-bzrlib-in-ec2-bug-624434 into lp:launchpad/devel.
=== modified file 'lib/devscripts/ec2test/entrypoint.py'
--- lib/devscripts/ec2test/entrypoint.py	2009-12-23 02:26:54 +0000
+++ lib/devscripts/ec2test/entrypoint.py	2010-08-26 04:38:41 +0000
@@ -3,6 +3,8 @@
 
 """The entry point for the 'ec2' utility."""
 
+from __future__ import with_statement
+
 __metaclass__ = type
 __all__ = [
     'main',
@@ -12,8 +14,8 @@
 import rlcompleter
 import sys
 
+import bzrlib
 from bzrlib.errors import BzrCommandError
-from bzrlib import ui
 
 from devscripts.ec2test import builtins
 from devscripts.ec2test.controller import (
@@ -33,19 +35,15 @@
 
     We run the specified command, or give help if none was specified.
     """
-    # XXX MichaelHudson, 2009-12-23, bug=499637: run_bzr fails unless you set
-    # a ui_factory.
-    ui.ui_factory = ui.make_ui_for_terminal(
-        sys.stdin, sys.stdout, sys.stderr)
-
-    controller = EC2CommandController()
-    controller.install_bzrlib_hooks()
-    controller.load_module(builtins)
-
-    args = sys.argv[1:]
-    if not args:
-        args = ['help']
-    try:
-        controller.run(args)
-    except BzrCommandError, e:
-        sys.exit('ec2: ERROR: ' + str(e))
+    with bzrlib.initialize():
+        controller = EC2CommandController()
+        controller.install_bzrlib_hooks()
+        controller.load_module(builtins)
+
+        args = sys.argv[1:]
+        if not args:
+            args = ['help']
+        try:
+            controller.run(args)
+        except BzrCommandError, e:
+            sys.exit('ec2: ERROR: ' + str(e))