Rev 5928: Merge trunk resolving conflicts in file:///home/vila/src/bzr/bugs/746991-selftest-exclude-ored/

Vincent Ladeuil v.ladeuil+lp at free.fr
Fri May 27 17:57:24 UTC 2011


At file:///home/vila/src/bzr/bugs/746991-selftest-exclude-ored/

------------------------------------------------------------
revno: 5928 [merge]
revision-id: v.ladeuil+lp at free.fr-20110527175723-vvm07ydeccenexg9
parent: v.ladeuil+lp at free.fr-20110527150217-uo2cs0n1do4fscli
parent: pqm at pqm.ubuntu.com-20110527171203-s50ymd0mviaw4c7k
committer: Vincent Ladeuil <v.ladeuil+lp at free.fr>
branch nick: 746991-selftest-exclude-ored
timestamp: Fri 2011-05-27 19:57:23 +0200
message:
  Merge trunk resolving conflicts
modified:
  bzrlib/builtins.py             builtins.py-20050830033751-fc01482b9ca23183
  bzrlib/config.py               config.py-20051011043216-070c74f4e9e338e8
  bzrlib/lockdir.py              lockdir.py-20060220222025-98258adf27fbdda3
  bzrlib/msgeditor.py            msgeditor.py-20050901111708-ef6d8de98f5d8f2f
  bzrlib/smart/server.py         server.py-20061110062051-chzu10y32vx8gvur-1
  bzrlib/tests/__init__.py       selftest.py-20050531073622-8d0e3c8845c97a64
  bzrlib/tests/blackbox/test_merge.py test_merge.py-20060323225809-9bc0459c19917f41
  bzrlib/tests/blackbox/test_serve.py test_serve.py-20060913064329-8t2pvmsikl4s3xhl-1
  bzrlib/tests/per_uifactory/__init__.py __init__.py-20090923045301-o12zypjwsidxn2hy-1
  bzrlib/tests/test_config.py    testconfig.py-20051011041908-742d0c15d8d8c8eb
  bzrlib/tests/test_import_tariff.py test_import_tariff.p-20100207155145-ff9infp7goncs7zh-1
  bzrlib/tests/test_script.py    test_script.py-20090901081156-y90z4w2t62fv7e7b-1
  bzrlib/tests/test_ui.py        test_ui.py-20051130162854-458e667a7414af09
  bzrlib/transport/gio_transport.py __init__.py-20100430125031-jb4f7q7mtyz55kz3-2
  bzrlib/transport/http/__init__.py http_transport.py-20050711212304-506c5fd1059ace96
  bzrlib/transport/http/_pycurl.py pycurlhttp.py-20060110060940-4e2a705911af77a6
  bzrlib/transport/http/_urllib2_wrappers.py _urllib2_wrappers.py-20060913231729-ha9ugi48ktx481ao-1
  bzrlib/transport/ssh.py        ssh.py-20060824042150-0s9787kng6zv1nwq-1
  bzrlib/ui/__init__.py          ui.py-20050824083933-8cf663c763ba53a9
  bzrlib/ui/text.py              text.py-20051130153916-2e438cffc8afc478
  doc/en/release-notes/bzr-2.4.txt bzr2.4.txt-20110114053217-k7ym9jfz243fddjm-1
  setup.py                       setup.py-20050314065409-02f8a0a6e3f9bc70
-------------- next part --------------
=== modified file 'bzrlib/builtins.py'
--- a/bzrlib/builtins.py	2011-05-27 14:11:36 +0000
+++ b/bzrlib/builtins.py	2011-05-27 17:57:23 +0000
@@ -3840,7 +3840,10 @@
     The source of the merge can be specified either in the form of a branch,
     or in the form of a path to a file containing a merge directive generated
     with bzr send. If neither is specified, the default is the upstream branch
-    or the branch most recently merged using --remember.
+    or the branch most recently merged using --remember.  The source of the
+    merge may also be specified in the form of a path to a file in another
+    branch:  in this case, only the modifications to that file are merged into
+    the current working tree.
 
     When merging from a branch, by default bzr will try to merge in all new
     work from the other branch, automatically determining an appropriate base
@@ -4010,6 +4013,13 @@
         self.sanity_check_merger(merger)
         if (merger.base_rev_id == merger.other_rev_id and
             merger.other_rev_id is not None):
+            # check if location is a nonexistent file (and not a branch) to
+            # disambiguate the 'Nothing to do'
+            if merger.interesting_files:
+                if not merger.other_tree.has_filename(
+                    merger.interesting_files[0]):
+                    note("merger: " + str(merger))
+                    raise errors.PathsDoNotExist([location])
             note('Nothing to do.')
             return 0
         if pull and not preview:
@@ -4958,7 +4968,7 @@
 
         if not force:
             if not ui.ui_factory.confirm_action(
-                    'Uncommit these revisions',
+                    u'Uncommit these revisions',
                     'bzrlib.builtins.uncommit',
                     {}):
                 self.outf.write('Canceled\n')

=== modified file 'bzrlib/config.py'
--- a/bzrlib/config.py	2011-05-20 14:46:02 +0000
+++ b/bzrlib/config.py	2011-05-27 10:02:53 +0000
@@ -1803,7 +1803,7 @@
             if ask:
                 if prompt is None:
                     # Create a default prompt suitable for most cases
-                    prompt = scheme.upper() + ' %(host)s username'
+                    prompt = u'%s' % (scheme.upper(),) + u' %(host)s username'
                 # Special handling for optional fields in the prompt
                 if port is not None:
                     prompt_host = '%s:%d' % (host, port)
@@ -1847,7 +1847,7 @@
         if password is None:
             if prompt is None:
                 # Create a default prompt suitable for most cases
-                prompt = '%s' % scheme.upper() + ' %(user)s@%(host)s password'
+                prompt = u'%s' % scheme.upper() + u' %(user)s@%(host)s password'
             # Special handling for optional fields in the prompt
             if port is not None:
                 prompt_host = '%s:%d' % (host, port)

=== modified file 'bzrlib/lockdir.py'
--- a/bzrlib/lockdir.py	2011-03-31 09:01:27 +0000
+++ b/bzrlib/lockdir.py	2011-05-16 13:39:39 +0000
@@ -355,7 +355,7 @@
             holder_info = self.peek()
         except LockCorrupt, e:
             # The lock info is corrupt.
-            if bzrlib.ui.ui_factory.get_boolean("Break (corrupt %r)" % (self,)):
+            if bzrlib.ui.ui_factory.get_boolean(u"Break (corrupt %r)" % (self,)):
                 self.force_break_corrupt(e.file_data)
             return
         if holder_info is not None:

=== modified file 'bzrlib/msgeditor.py'
--- a/bzrlib/msgeditor.py	2011-05-24 09:52:04 +0000
+++ b/bzrlib/msgeditor.py	2011-05-27 05:16:48 +0000
@@ -151,7 +151,7 @@
         edited_content = msg_transport.get_bytes(basename)
         if edited_content == reference_content:
             if not ui.ui_factory.confirm_action(
-                "Commit message was not edited, use anyway",
+                u"Commit message was not edited, use anyway",
                 "bzrlib.msgeditor.unchanged",
                 {}):
                 # Returning "" makes cmd_commit raise 'empty commit message

=== modified file 'bzrlib/smart/server.py'
--- a/bzrlib/smart/server.py	2011-03-30 11:45:54 +0000
+++ b/bzrlib/smart/server.py	2011-05-27 13:12:09 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2006-2010 Canonical Ltd
+# Copyright (C) 2006-2011 Canonical Ltd
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -254,6 +254,11 @@
             "Called by the bzr server when it stops serving a directory. "
             "server_stopped is called with the same parameters as the "
             "server_started hook: (backing_urls, public_url).", (0, 16))
+        self.add_hook('server_exception',
+            "Called by the bzr server when an exception occurs. "
+            "server_exception is called with the sys.exc_info() tuple "
+            "return true for the hook if the exception has been handled, "
+            "in which case the server will exit normally.", (2, 4))
 
 SmartTCPServer.hooks = SmartServerHooks()
 
@@ -373,7 +378,6 @@
         for cleanup in reversed(self.cleanups):
             cleanup()
 
-
 def serve_bzr(transport, host=None, port=None, inet=False):
     """This is the default implementation of 'bzr serve'.
     
@@ -385,6 +389,11 @@
     try:
         bzr_server.set_up(transport, host, port, inet)
         bzr_server.smart_server.serve()
+    except:
+        hook_caught_exception = False
+        for hook in SmartTCPServer.hooks['server_exception']:
+            hook_caught_exception = hook(sys.exc_info())
+        if not hook_caught_exception:
+            raise
     finally:
         bzr_server.tear_down()
-

=== modified file 'bzrlib/tests/__init__.py'
--- a/bzrlib/tests/__init__.py	2011-05-26 08:05:45 +0000
+++ b/bzrlib/tests/__init__.py	2011-05-27 02:22:45 +0000
@@ -2013,7 +2013,7 @@
     def start_bzr_subprocess(self, process_args, env_changes=None,
                              skip_if_plan_to_signal=False,
                              working_dir=None,
-                             allow_plugins=False):
+                             allow_plugins=False, stderr=subprocess.PIPE):
         """Start bzr in a subprocess for testing.
 
         This starts a new Python interpreter and runs bzr in there.
@@ -2031,6 +2031,9 @@
         :param skip_if_plan_to_signal: raise TestSkipped when true and system
             doesn't support signalling subprocesses.
         :param allow_plugins: If False (default) pass --no-plugins to bzr.
+        :param stderr: file to use for the subprocess's stderr.  Valid values
+            are those valid for the stderr argument of `subprocess.Popen`.
+            Default value is ``subprocess.PIPE``.
 
         :returns: Popen object for the started process.
         """
@@ -2071,7 +2074,7 @@
             command.extend(process_args)
             process = self._popen(command, stdin=subprocess.PIPE,
                                   stdout=subprocess.PIPE,
-                                  stderr=subprocess.PIPE)
+                                  stderr=stderr)
         finally:
             restore_environment()
             if cwd is not None:

=== modified file 'bzrlib/tests/blackbox/test_merge.py'
--- a/bzrlib/tests/blackbox/test_merge.py	2011-05-19 08:32:55 +0000
+++ b/bzrlib/tests/blackbox/test_merge.py	2011-05-27 09:45:44 +0000
@@ -353,6 +353,17 @@
         self.assertPathExists('file1')
         self.assertPathDoesNotExist('file2')
 
+    def test_merge_nonexistent_file(self):
+        """It should not be possible to merge changes from a file which
+        does not exist."""
+        tree_a = self.make_branch_and_tree('tree_a')
+        self.build_tree_contents([('tree_a/file', 'bar\n')])
+        tree_a.add(['file'])
+        tree_a.commit('commit 1')
+        os.chdir('tree_a')
+        self.run_bzr_error(('Path\(s\) do not exist: non/existing',),
+                           ['merge', 'non/existing'])
+
     def pullable_branch(self):
         tree_a = self.make_branch_and_tree('a')
         self.build_tree_contents([('a/file', 'bar\n')])

=== modified file 'bzrlib/tests/blackbox/test_serve.py'
--- a/bzrlib/tests/blackbox/test_serve.py	2011-05-26 08:05:45 +0000
+++ b/bzrlib/tests/blackbox/test_serve.py	2011-05-27 13:12:23 +0000
@@ -81,7 +81,7 @@
             'run_bzr_serve_then_func hook')
         # start a TCP server
         try:
-            out, err = self.run_bzr(['serve'] + list(serve_args))
+            out, err = self.run_bzr(['serve'] + list(serve_args), retcode=retcode)
         except KeyboardInterrupt, e:
             out, err = e.args
         return out, err
@@ -93,6 +93,24 @@
         super(TestBzrServe, self).setUp()
         self.disable_missing_extensions_warning()
 
+    def test_server_exception_with_hook(self):
+        """test exception hook works to catch exceptions from server"""
+        def hook(exception):
+            from bzrlib.trace import note
+            note("catching exception")
+            return True
+        SmartTCPServer.hooks.install_named_hook(
+            'server_exception', hook,
+            'test_server_except_hook hook')
+        args = []
+        out, err = self.run_bzr_serve_then_func(args, retcode=0)
+        self.assertEqual('listening on port: 4155\ncatching exception\n', err)
+
+    def test_server_exception_no_hook(self):
+        """test exception without hook returns error"""
+        args = []
+        out, err = self.run_bzr_serve_then_func(args, retcode=3)
+
     def assertInetServerShutsdownCleanly(self, process):
         """Shutdown the server process looking for errors."""
         # Shutdown the server: the server should shut down when it cannot read

=== modified file 'bzrlib/tests/per_uifactory/__init__.py'
--- a/bzrlib/tests/per_uifactory/__init__.py	2011-01-10 22:20:12 +0000
+++ b/bzrlib/tests/per_uifactory/__init__.py	2011-05-16 14:02:27 +0000
@@ -66,9 +66,8 @@
         # confirm_action should be answered by every ui factory; even
         # noninteractive ones should have a reasonable default
         self._load_responses([True])
-        result = self.factory.confirm_action(
-            'Break a lock?',
-            'bzr.lock.break.confirm',
+        result = self.factory.confirm_action(u'Break a lock?',
+             'bzr.lock.break.confirm',
             {})
         # will be true either because we read it from the input or because
         # that's the default

=== modified file 'bzrlib/tests/test_config.py'
--- a/bzrlib/tests/test_config.py	2011-05-25 14:17:27 +0000
+++ b/bzrlib/tests/test_config.py	2011-05-27 10:02:53 +0000
@@ -2735,11 +2735,11 @@
 
     def test_username_defaults_prompts(self):
         # HTTP prompts can't be tested here, see test_http.py
-        self._check_default_username_prompt('FTP %(host)s username: ', 'ftp')
-        self._check_default_username_prompt(
-            'FTP %(host)s:%(port)d username: ', 'ftp', port=10020)
-        self._check_default_username_prompt(
-            'SSH %(host)s:%(port)d username: ', 'ssh', port=12345)
+        self._check_default_username_prompt(u'FTP %(host)s username: ', 'ftp')
+        self._check_default_username_prompt(
+            u'FTP %(host)s:%(port)d username: ', 'ftp', port=10020)
+        self._check_default_username_prompt(
+            u'SSH %(host)s:%(port)d username: ', 'ssh', port=12345)
 
     def test_username_default_no_prompt(self):
         conf = config.AuthenticationConfig()
@@ -2751,22 +2751,21 @@
     def test_password_default_prompts(self):
         # HTTP prompts can't be tested here, see test_http.py
         self._check_default_password_prompt(
-            'FTP %(user)s@%(host)s password: ', 'ftp')
-        self._check_default_password_prompt(
-            'FTP %(user)s@%(host)s:%(port)d password: ', 'ftp', port=10020)
-        self._check_default_password_prompt(
-            'SSH %(user)s@%(host)s:%(port)d password: ', 'ssh', port=12345)
+            u'FTP %(user)s@%(host)s password: ', 'ftp')
+        self._check_default_password_prompt(
+            u'FTP %(user)s@%(host)s:%(port)d password: ', 'ftp', port=10020)
+        self._check_default_password_prompt(
+            u'SSH %(user)s@%(host)s:%(port)d password: ', 'ssh', port=12345)
         # SMTP port handling is a bit special (it's handled if embedded in the
         # host too)
         # FIXME: should we: forbid that, extend it to other schemes, leave
         # things as they are that's fine thank you ?
-        self._check_default_password_prompt('SMTP %(user)s@%(host)s password: ',
-                                            'smtp')
-        self._check_default_password_prompt('SMTP %(user)s@%(host)s password: ',
-                                            'smtp', host='bar.org:10025')
-        self._check_default_password_prompt(
-            'SMTP %(user)s@%(host)s:%(port)d password: ',
-            'smtp', port=10025)
+        self._check_default_password_prompt(
+            u'SMTP %(user)s@%(host)s password: ', 'smtp')
+        self._check_default_password_prompt(
+            u'SMTP %(user)s@%(host)s password: ', 'smtp', host='bar.org:10025')
+        self._check_default_password_prompt(
+            u'SMTP %(user)s@%(host)s:%(port)d password: ', 'smtp', port=10025)
 
     def test_ssh_password_emits_warning(self):
         conf = config.AuthenticationConfig(_file=StringIO(

=== modified file 'bzrlib/tests/test_import_tariff.py'
--- a/bzrlib/tests/test_import_tariff.py	2011-05-03 23:16:56 +0000
+++ b/bzrlib/tests/test_import_tariff.py	2011-05-27 14:50:58 +0000
@@ -62,7 +62,7 @@
             self.preserved_env_vars[name] = os.environ.get(name)
         super(TestImportTariffs, self).setUp()
 
-    def start_bzr_subprocess_with_import_check(self, args):
+    def start_bzr_subprocess_with_import_check(self, args, stderr_file=None):
         """Run a bzr process and capture the imports.
 
         This is fairly expensive because we start a subprocess, so we aim to
@@ -79,8 +79,13 @@
         # explicitly do want to test against things installed there, therefore
         # we pass it through.
         env_changes = dict(PYTHONVERBOSE='1', **self.preserved_env_vars)
-        return self.start_bzr_subprocess(args, env_changes=env_changes,
-            allow_plugins=(not are_plugins_disabled()))
+        kwargs = dict(env_changes=env_changes,
+                      allow_plugins=(not are_plugins_disabled()))
+        if stderr_file:
+            # We don't want to update the whole call chain so we insert stderr
+            # *iff* we need to
+            kwargs['stderr'] = stderr_file
+        return self.start_bzr_subprocess(args, **kwargs)
 
     def check_forbidden_modules(self, err, forbidden_imports):
         """Check for forbidden modules in stderr.
@@ -187,8 +192,11 @@
     def test_simple_serve(self):
         # 'serve' in a default format working tree shouldn't need many modules
         tree = self.make_branch_and_tree('.')
+        # Capture the bzr serve process' stderr in a file to avoid deadlocks
+        # while the smart client interacts with it.
+        stderr_file = open('bzr-serve.stderr', 'w')
         process = self.start_bzr_subprocess_with_import_check(['serve',
-            '--inet', '-d', tree.basedir])
+            '--inet', '-d', tree.basedir], stderr_file=stderr_file)
         url = 'bzr://localhost/'
         self.permit_url(url)
         client_medium = medium.SmartSimplePipesClientMedium(
@@ -200,6 +208,9 @@
         process.stdin = None
         (out, err) = self.finish_bzr_subprocess(process,
             universal_newlines=False)
+        stderr_file.close()
+        with open('bzr-serve.stderr', 'r') as stderr_file:
+            err = stderr_file.read()
         self.check_forbidden_modules(err,
             ['bzrlib.annotate',
             'bzrlib.atomicfile',

=== modified file 'bzrlib/tests/test_script.py'
--- a/bzrlib/tests/test_script.py	2011-05-13 12:51:05 +0000
+++ b/bzrlib/tests/test_script.py	2011-05-16 13:39:39 +0000
@@ -558,7 +558,7 @@
 
     def run(self):
         if ui.ui_factory.get_boolean(
-            'Really do it',
+            u'Really do it',
             # 'bzrlib.tests.test_script.confirm',
             # {}
             ):

=== modified file 'bzrlib/tests/test_ui.py'
--- a/bzrlib/tests/test_ui.py	2011-04-05 17:37:53 +0000
+++ b/bzrlib/tests/test_ui.py	2011-05-16 13:39:39 +0000
@@ -63,7 +63,7 @@
     def test_text_factory_confirm(self):
         # turns into reading a regular boolean
         ui = self.make_test_ui_factory('n\n')
-        self.assertEquals(ui.confirm_action('Should %(thing)s pass?',
+        self.assertEquals(ui.confirm_action(u'Should %(thing)s pass?',
             'bzrlib.tests.test_ui.confirmation',
             {'thing': 'this'},),
             False)
@@ -119,12 +119,12 @@
         stdout = tests.StringIOWrapper()
         stderr = tests.StringIOWrapper()
         factory = _mod_ui_text.TextUIFactory(stdin, stdout, stderr)
-        self.assertEqual(True, factory.get_boolean(""))
-        self.assertEqual(False, factory.get_boolean(""))
-        self.assertEqual(True, factory.get_boolean(""))
-        self.assertEqual(False, factory.get_boolean(""))
-        self.assertEqual(True, factory.get_boolean(""))
-        self.assertEqual(False, factory.get_boolean(""))
+        self.assertEqual(True, factory.get_boolean(u""))
+        self.assertEqual(False, factory.get_boolean(u""))
+        self.assertEqual(True, factory.get_boolean(u""))
+        self.assertEqual(False, factory.get_boolean(u""))
+        self.assertEqual(True, factory.get_boolean(u""))
+        self.assertEqual(False, factory.get_boolean(u""))
         self.assertEqual("foo\n", factory.stdin.read())
         # stdin should be empty
         self.assertEqual('', factory.stdin.readline())
@@ -137,15 +137,15 @@
         stdout = tests.StringIOWrapper()
         stderr = tests.StringIOWrapper()
         factory = _mod_ui_text.TextUIFactory(stdin, stdout, stderr)
-        self.assertEqual(1, factory.get_integer(""))
-        self.assertEqual(-2, factory.get_integer(""))
-        self.assertEqual(42, factory.get_integer(""))
+        self.assertEqual(1, factory.get_integer(u""))
+        self.assertEqual(-2, factory.get_integer(u""))
+        self.assertEqual(42, factory.get_integer(u""))
 
     def test_text_factory_prompt(self):
         # see <https://launchpad.net/bugs/365891>
         StringIO = tests.StringIOWrapper
         factory = _mod_ui_text.TextUIFactory(StringIO(), StringIO(), StringIO())
-        factory.prompt('foo %2e')
+        factory.prompt(u'foo %2e')
         self.assertEqual('', factory.stdout.getvalue())
         self.assertEqual('foo %2e', factory.stderr.getvalue())
 
@@ -166,7 +166,7 @@
                          self.apply_redirected(None, factory.stdout,
                                                factory.stdout,
                                                factory.get_boolean,
-                                               "what do you want"))
+                                               u"what do you want"))
         output = out.getvalue()
         self.assertContainsRe(output,
             "| foo *\r\r  *\r*")
@@ -195,10 +195,10 @@
         factory.stdout.encoding = "utf8"
         # there is no output from the base factory
         self.assertEqual("someuser",
-                         factory.get_username('Hello %(host)s', host='some'))
+                         factory.get_username(u'Hello %(host)s', host='some'))
         self.assertEquals("Hello some: ", factory.stderr.getvalue())
         self.assertEquals('', factory.stdout.getvalue())
-        self.assertEqual("", factory.get_username("Gebruiker"))
+        self.assertEqual("", factory.get_username(u"Gebruiker"))
         # stdin should be empty
         self.assertEqual('', factory.stdin.readline())
 
@@ -352,7 +352,7 @@
         self.assertRaises(
             NotImplementedError,
             self.apply_redirected,
-            None, stdout, stdout, factory.get_boolean, "foo")
+            None, stdout, stdout, factory.get_boolean, u"foo")
 
 
 class TestUIFactoryTests(tests.TestCase):
@@ -371,12 +371,12 @@
 
     def test_canned_input_get_input(self):
         uif = _mod_ui.CannedInputUIFactory([True, 'mbp', 'password', 42])
-        self.assertEqual(True, uif.get_boolean('Extra cheese?'))
-        self.assertEqual('mbp', uif.get_username('Enter your user name'))
+        self.assertEqual(True, uif.get_boolean(u'Extra cheese?'))
+        self.assertEqual('mbp', uif.get_username(u'Enter your user name'))
         self.assertEqual('password',
-                         uif.get_password('Password for %(host)s',
+                         uif.get_password(u'Password for %(host)s',
                                           host='example.com'))
-        self.assertEqual(42, uif.get_integer('And all that jazz ?'))
+        self.assertEqual(42, uif.get_integer(u'And all that jazz ?'))
 
 
 class TestBoolFromString(tests.TestCase):

=== modified file 'bzrlib/transport/gio_transport.py'
--- a/bzrlib/transport/gio_transport.py	2010-08-30 07:42:12 +0000
+++ b/bzrlib/transport/gio_transport.py	2011-05-27 10:02:53 +0000
@@ -176,7 +176,7 @@
         user = None
         if (flags & gio.ASK_PASSWORD_NEED_USERNAME and
                 flags & gio.ASK_PASSWORD_NEED_DOMAIN):
-            prompt = scheme.upper() + ' %(host)s DOMAIN\username'
+            prompt = u'%s' % (scheme.upper(),) + u' %(host)s DOMAIN\\username'
             user_and_domain = auth.get_user(scheme, host,
                     port=port, ask=True, prompt=prompt)
             (domain, user) = user_and_domain.split('\\', 1)
@@ -191,7 +191,7 @@
             #a DOMAIN and a username prompt should be the
             #same so I will missuse the ui_factory get_username
             #a little bit here.
-            prompt = scheme.upper() + ' %(host)s DOMAIN'
+            prompt = u'%s' % (scheme.upper(),) + u' %(host)s DOMAIN'
             domain = ui.ui_factory.get_username(prompt=prompt)
             op.set_domain(domain)
 

=== modified file 'bzrlib/transport/http/__init__.py'
--- a/bzrlib/transport/http/__init__.py	2011-01-26 19:34:58 +0000
+++ b/bzrlib/transport/http/__init__.py	2011-05-27 07:39:41 +0000
@@ -74,7 +74,7 @@
             password = urllib.unquote(password)
         else:
             password = ui.ui_factory.get_password(
-                prompt='HTTP %(user)s@%(host)s password',
+                prompt=u'HTTP %(user)s@%(host)s password',
                 user=username, host=host)
         password_manager.add_password(None, host, username, password)
     url = urlparse.urlunsplit((scheme, netloc, path, query, fragment))

=== modified file 'bzrlib/transport/http/_pycurl.py'
--- a/bzrlib/transport/http/_pycurl.py	2010-11-06 10:55:58 +0000
+++ b/bzrlib/transport/http/_pycurl.py	2011-05-27 07:39:41 +0000
@@ -301,7 +301,9 @@
         The URL and code are automatically included as appropriate.
 
         :param info: Extra information to include in the message.
-        :param body: File-like object from which the body of the page can be read.
+
+        :param body: File-like object from which the body of the page can be
+            read.
         """
         code = curl.getinfo(pycurl.HTTP_CODE)
         url = curl.getinfo(pycurl.EFFECTIVE_URL)
@@ -321,7 +323,7 @@
             else:
                 msg = ': ' + info
             raise errors.InvalidHttpResponse(
-                url, 'Unable to handle http code %d%s: %s' 
+                url, 'Unable to handle http code %d%s: %s'
                 % (code, msg, plaintext_body))
 
     def _debug_cb(self, kind, text):

=== modified file 'bzrlib/transport/http/_urllib2_wrappers.py'
--- a/bzrlib/transport/http/_urllib2_wrappers.py	2011-05-12 07:53:55 +0000
+++ b/bzrlib/transport/http/_urllib2_wrappers.py	2011-05-27 07:39:41 +0000
@@ -1260,11 +1260,11 @@
         user. The daughter classes should implements a public
         build_password_prompt using this method.
         """
-        prompt = '%s' % auth['protocol'].upper() + ' %(user)s@%(host)s'
+        prompt = u'%s' % auth['protocol'].upper() + u' %(user)s@%(host)s'
         realm = auth['realm']
         if realm is not None:
-            prompt += ", Realm: '%s'" % realm
-        prompt += ' password'
+            prompt += u", Realm: '%s'" % realm.decode('utf8')
+        prompt += u' password'
         return prompt
 
     def _build_username_prompt(self, auth):
@@ -1278,11 +1278,11 @@
         user. The daughter classes should implements a public
         build_username_prompt using this method.
         """
-        prompt = '%s' % auth['protocol'].upper() + ' %(host)s'
+        prompt = u'%s' % auth['protocol'].upper() + u' %(host)s'
         realm = auth['realm']
         if realm is not None:
-            prompt += ", Realm: '%s'" % realm
-        prompt += ' username'
+            prompt += u", Realm: '%s'" % realm.decode('utf8')
+        prompt += u' username'
         return prompt
 
     def http_request(self, request):
@@ -1552,12 +1552,12 @@
 
     def build_password_prompt(self, auth):
         prompt = self._build_password_prompt(auth)
-        prompt = 'Proxy ' + prompt
+        prompt = u'Proxy ' + prompt
         return prompt
 
     def build_username_prompt(self, auth):
         prompt = self._build_username_prompt(auth)
-        prompt = 'Proxy ' + prompt
+        prompt = u'Proxy ' + prompt
         return prompt
 
     def http_error_407(self, req, fp, code, msg, headers):

=== modified file 'bzrlib/transport/ssh.py'
--- a/bzrlib/transport/ssh.py	2011-01-11 20:20:13 +0000
+++ b/bzrlib/transport/ssh.py	2011-05-16 13:39:39 +0000
@@ -573,7 +573,8 @@
         return True
     except paramiko.PasswordRequiredException:
         password = ui.ui_factory.get_password(
-            prompt='SSH %(filename)s password', filename=filename)
+            prompt=u'SSH %(filename)s password',
+            filename=filename.decode(osutils._fs_enc))
         try:
             key = pkey_class.from_private_key_file(filename, password)
             paramiko_transport.auth_publickey(username, key)

=== modified file 'bzrlib/ui/__init__.py'
--- a/bzrlib/ui/__init__.py	2011-05-19 09:32:38 +0000
+++ b/bzrlib/ui/__init__.py	2011-05-27 05:16:48 +0000
@@ -204,10 +204,10 @@
         """
         return self.get_boolean(prompt % prompt_kwargs)
 
-    def get_password(self, prompt='', **kwargs):
+    def get_password(self, prompt=u'', **kwargs):
         """Prompt the user for a password.
 
-        :param prompt: The prompt to present the user
+        :param prompt: The prompt to present the user (must be unicode)
         :param kwargs: Arguments which will be expanded into the prompt.
                        This lets front ends display different things if
                        they so choose.
@@ -483,7 +483,7 @@
     def get_integer(self, prompt):
         return self.responses.pop(0)
 
-    def get_password(self, prompt='', **kwargs):
+    def get_password(self, prompt=u'', **kwargs):
         return self.responses.pop(0)
 
     def get_username(self, prompt, **kwargs):

=== modified file 'bzrlib/ui/text.py'
--- a/bzrlib/ui/text.py	2011-04-07 10:36:24 +0000
+++ b/bzrlib/ui/text.py	2011-05-16 13:39:39 +0000
@@ -114,7 +114,7 @@
                 password = password[:-1]
         return password
 
-    def get_password(self, prompt='', **kwargs):
+    def get_password(self, prompt=u'', **kwargs):
         """Prompt the user for a password.
 
         :param prompt: The prompt to present the user
@@ -198,6 +198,8 @@
         :param kwargs: Dictionary of arguments to insert into the prompt,
             to allow UIs to reformat the prompt.
         """
+        if type(prompt) != unicode:
+            raise ValueError("prompt %r not a unicode string" % prompt)
         if kwargs:
             # See <https://launchpad.net/bugs/365891>
             prompt = prompt % kwargs

=== modified file 'doc/en/release-notes/bzr-2.4.txt'
--- a/doc/en/release-notes/bzr-2.4.txt	2011-05-27 14:11:36 +0000
+++ b/doc/en/release-notes/bzr-2.4.txt	2011-05-27 17:57:23 +0000
@@ -20,6 +20,10 @@
 
 .. New commands, options, etc that users may wish to try out.
 
+* New hook server_exception in bzrlib.smart.server to catch any
+  exception caused while running bzr serve.  (Jonathan Riddell,
+  #274578)
+
 Improvements
 ************
 
@@ -32,9 +36,21 @@
 .. Fixes for situations where bzr would previously crash or give incorrect
    or undesirable results.
 
+* Pass the ``build_mo`` command to the rest of the setup() calls in
+  setup.py. The ``bdist_wininst`` and ``py2exe`` code paths were failing
+  because ``build_mo`` became a required step that they didn't know about.
+  (John Arbash Meinel, #787122)
+
 * Reports the original error when an InvalidHttpResponse exception is
   encountered to facilitate debug. (Vincent Ladeuil, #788530)
 
+* Reports a non-existant file error when trying to merge in a file
+  that does not exist. (Jonathan Riddell, #330063)
+
+* ``UIFactory.prompt``, ``UIFactory.get_username``,
+  ``UIFactory.get_password`` and ``UIFactory.get_boolean`` now require a
+  unicode prompt to be passed in. (Jelmer Vernooij, #592083)
+
 Documentation
 *************
 
@@ -62,6 +78,12 @@
    suite.  This can include new facilities for writing tests, fixes to 
    spurious test failures and changes to the way things should be tested.
 
+* Fix deadlock in `TestImportTariffs.test_simple_serve` when stderr gets
+  more output than fits in the default buffer.  This was happening on the
+  Windows buildslave, and could easily happen in other circumstances where
+  the default OS buffer size for pipes is small or the ``python -v``
+  output is large.  (Andrew Bennetts, #784802)
+
 * Multiple ``selftest --exclude`` options are now combined instead of
   overriding each other. (Vincent Ladeuil, #746991)
 

=== modified file 'setup.py'
--- a/setup.py	2011-05-17 00:45:09 +0000
+++ b/setup.py	2011-05-26 21:24:36 +0000
@@ -502,13 +502,13 @@
             # help pages
             'data_files': find_docs(),
             # for building pyrex extensions
-            'cmdclass': {'build_ext': build_ext_if_possible},
+            'cmdclass': command_classes,
            }
 
     ARGS.update(META_INFO)
     ARGS.update(BZRLIB)
     ARGS.update(PKG_DATA)
-    
+
     setup(**ARGS)
 
 elif 'py2exe' in sys.argv:
@@ -725,13 +725,14 @@
             self.optimize = 2
 
     if __name__ == '__main__':
+        command_classes['install_data'] = install_data_with_bytecompile
+        command_classes['py2exe'] = py2exe_no_oo_exe
         setup(options=options_list,
               console=console_targets,
               windows=gui_targets,
               zipfile='lib/library.zip',
               data_files=data_files,
-              cmdclass={'install_data': install_data_with_bytecompile,
-                        'py2exe': py2exe_no_oo_exe},
+              cmdclass=command_classes,
               )
 
 else:



More information about the bazaar-commits mailing list