Rev 4752: (mbp) Remove deprecated CLIUIFactory in file:///home/pqm/archives/thelove/bzr/%2Btrunk/

Canonical.com Patch Queue Manager pqm at pqm.ubuntu.com
Fri Oct 16 01:10:29 BST 2009


At file:///home/pqm/archives/thelove/bzr/%2Btrunk/

------------------------------------------------------------
revno: 4752 [merge]
revision-id: pqm at pqm.ubuntu.com-20091016001026-ynt6ehpic8bzlrkz
parent: pqm at pqm.ubuntu.com-20091015232639-sgyy127lljaca1ty
parent: john at arbash-meinel.com-20091015200437-4wweb0t6uzspvv84
committer: Canonical.com Patch Queue Manager <pqm at pqm.ubuntu.com>
branch nick: +trunk
timestamp: Fri 2009-10-16 01:10:26 +0100
message:
  (mbp) Remove deprecated CLIUIFactory
modified:
  NEWS                           NEWS-20050323055033-4e00b5db738777ff
  bzrlib/tests/test_ui.py        test_ui.py-20051130162854-458e667a7414af09
  bzrlib/ui/__init__.py          ui.py-20050824083933-8cf663c763ba53a9
=== modified file 'NEWS'
--- a/NEWS	2009-10-15 21:28:14 +0000
+++ b/NEWS	2009-10-16 00:10:26 +0000
@@ -36,6 +36,8 @@
 API Changes
 ***********
 
+* Remove deprecated ``CLIUIFactory``.  (Martin Pool)
+
 * ``UIFactory`` now has new ``show_error``, ``show_message`` and
   ``show_warning`` methods, which can be hooked by non-text UIs.  
   (Martin Pool)

=== modified file 'bzrlib/tests/test_ui.py'
--- a/bzrlib/tests/test_ui.py	2009-10-14 08:51:44 +0000
+++ b/bzrlib/tests/test_ui.py	2009-10-15 20:04:37 +0000
@@ -42,7 +42,6 @@
     )
 from bzrlib.ui import (
     CannedInputUIFactory,
-    CLIUIFactory,
     SilentUIFactory,
     UIFactory,
     make_ui_for_terminal,
@@ -307,15 +306,6 @@
                 'TERM=%r' % (term_type,))
 
 
-class CLIUITests(TestCase):
-
-    def test_cli_factory_deprecated(self):
-        uif = self.applyDeprecated(deprecated_in((1, 18, 0)),
-            CLIUIFactory,
-            StringIO(), StringIO(), StringIO())
-        self.assertIsInstance(uif, UIFactory)
-
-
 class SilentUITests(TestCase):
 
     def test_silent_factory_get_password(self):

=== modified file 'bzrlib/ui/__init__.py'
--- a/bzrlib/ui/__init__.py	2009-09-23 06:29:46 +0000
+++ b/bzrlib/ui/__init__.py	2009-10-15 20:04:37 +0000
@@ -226,95 +226,6 @@
 
 
 
-class CLIUIFactory(UIFactory):
-    """Deprecated in favor of TextUIFactory."""
-
-    @deprecated_method(deprecated_in((1, 18, 0)))
-    def __init__(self, stdin=None, stdout=None, stderr=None):
-        UIFactory.__init__(self)
-        self.stdin = stdin or sys.stdin
-        self.stdout = stdout or sys.stdout
-        self.stderr = stderr or sys.stderr
-
-    _accepted_boolean_strings = dict(y=True, n=False, yes=True, no=False)
-
-    def get_boolean(self, prompt):
-        while True:
-            self.prompt(prompt + "? [y/n]: ")
-            line = self.stdin.readline()
-            line = line.rstrip('\n')
-            val = bool_from_string(line, self._accepted_boolean_strings)
-            if val is not None:
-                return val
-
-    def get_non_echoed_password(self):
-        isatty = getattr(self.stdin, 'isatty', None)
-        if isatty is not None and isatty():
-            # getpass() ensure the password is not echoed and other
-            # cross-platform niceties
-            password = getpass.getpass('')
-        else:
-            # echo doesn't make sense without a terminal
-            password = self.stdin.readline()
-            if not password:
-                password = None
-            elif password[-1] == '\n':
-                password = password[:-1]
-        return password
-
-    def get_password(self, prompt='', **kwargs):
-        """Prompt the user for a password.
-
-        :param prompt: The prompt to present the user
-        :param kwargs: Arguments which will be expanded into the prompt.
-                       This lets front ends display different things if
-                       they so choose.
-        :return: The password string, return None if the user
-                 canceled the request.
-        """
-        prompt += ': '
-        self.prompt(prompt, **kwargs)
-        # There's currently no way to say 'i decline to enter a password'
-        # as opposed to 'my password is empty' -- does it matter?
-        return self.get_non_echoed_password()
-
-    def get_username(self, prompt, **kwargs):
-        """Prompt the user for a username.
-
-        :param prompt: The prompt to present the user
-        :param kwargs: Arguments which will be expanded into the prompt.
-                       This lets front ends display different things if
-                       they so choose.
-        :return: The username string, return None if the user
-                 canceled the request.
-        """
-        prompt += ': '
-        self.prompt(prompt, **kwargs)
-        username = self.stdin.readline()
-        if not username:
-            username = None
-        elif username[-1] == '\n':
-            username = username[:-1]
-        return username
-
-    def prompt(self, prompt, **kwargs):
-        """Emit prompt on the CLI.
-        
-        :param kwargs: Dictionary of arguments to insert into the prompt,
-            to allow UIs to reformat the prompt.
-        """
-        if kwargs:
-            # See <https://launchpad.net/bugs/365891>
-            prompt = prompt % kwargs
-        prompt = prompt.encode(osutils.get_terminal_encoding(), 'replace')
-        self.clear_term()
-        self.stderr.write(prompt)
-
-    def note(self, msg):
-        """Write an already-formatted message."""
-        self.stdout.write(msg + '\n')
-
-
 class SilentUIFactory(UIFactory):
     """A UI Factory which never prints anything.
 
@@ -368,13 +279,6 @@
                 % (self,))
 
 
- at deprecated_function(deprecated_in((1, 18, 0)))
-def clear_decorator(func, *args, **kwargs):
-    """Decorator that clears the term"""
-    ui_factory.clear_term()
-    func(*args, **kwargs)
-
-
 ui_factory = SilentUIFactory()
 # IMPORTANT: never import this symbol directly. ONLY ever access it as
 # ui.ui_factory, so that you refer to the current value.




More information about the bazaar-commits mailing list