bzr 1.12 lost progress bar?

John Arbash Meinel john at arbash-meinel.com
Thu Mar 5 15:17:51 GMT 2009


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Martin Pool wrote:
> 2009/2/26 Matt Doran <matt.doran at papercut.com>:
>> Done!  https://bugs.launchpad.net/bugs/334808
> 
> I was hoping to look at this, but I haven't got around to it yet.
> Could someone who commonly runs Windows maybe poke into it, and I will
> help you with a patch or with getting it merged for 1.13?
> 
> Actually I think this will do it, if someone could test it:
> 
> === modified file 'bzrlib/ui/__init__.py'
> --- bzrlib/ui/__init__.py	2009-02-23 15:42:47 +0000
> +++ bzrlib/ui/__init__.py	2009-03-05 08:34:08 +0000
> @@ -237,7 +237,8 @@
>      cls = None
>      isatty = getattr(stdin, 'isatty', None)
>      if isatty is None:
> -        cls = CLIUIFactory
> +        # probably Windows, etc
> +        cls = TextUIFactory
>      elif not isatty():
>          cls = CLIUIFactory
>      elif os.environ.get('TERM') in (None, 'dumb', ''):
> 
> 

So, I use bzr.dev on Win32 all the time, and still see progress bars. So
at best, this only happens when running the compiled executable. I
certainly don't see why stdin would inherently be mutated as part of
running under a script. Though perhaps that is true.

More to the point, should we be doing the check on 'stdin'? It seems
like 'stderr' is the most appropriate object, as that is where all the
messages are being sent.

Otherwise doing:

XXX | bzr command

Will hide the progress bar.

Certainly we don't really want to use stdout for the same reason:
bzr command > foo

Would suppress the progress bar as well. Which would make sense for:
bzr command 2>&1 >foo

sort of thing.

So what about this change instead:
=== modified file 'bzrlib/ui/__init__.py'
- --- bzrlib/ui/__init__.py       2009-02-23 15:42:47 +0000
+++ bzrlib/ui/__init__.py       2009-03-05 15:17:34 +0000
@@ -235,7 +235,7 @@
     progress indicators, etc.  If it's a dumb terminal, just plain text
output.
     """
     cls = None
- -    isatty = getattr(stdin, 'isatty', None)
+    isatty = getattr(stderr, 'isatty', None)
     if isatty is None:
         cls = CLIUIFactory
     elif not isatty():

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkmv7R8ACgkQJdeBCYSNAAMjAwCfdKDgxXg5nDERadLzbqCYbS51
5DcAn24dklSADjgZ+wplHPlSXhUtfkUt
=IDXy
-----END PGP SIGNATURE-----



More information about the bazaar mailing list