[PATCH] Better patch (??)

Magnus Therning magnus at therning.org
Thu Apr 14 14:24:41 BST 2005


On Thu, Apr 14, 2005 at 10:57:14AM +0100, Magnus Therning wrote:
>On Thu, Apr 14, 2005 at 08:48:03AM +1000, Martin Pool wrote:
>>On Wed, 2005-04-13 at 19:26 +0200, Simon Ekstrand wrote:
>>> Olivier Grisel <olivier.grisel at ensta.org> writes:
>>> 
>>> > Erik Bågfors wrote:
>>> >> I rsynced as I read this mail, tried the tests and they all passed.
>>> >> /Erik
>>> >
>>> > As I did but they are broken on my box (up2date Ubuntu Hoary with cElementTree):
>>> >
>>> > ogrisel at groyours:~/bazaar-ng $ python -c "import locale; print
>>> > locale.getpreferredencoding()"
>>> > ISO-8859-15
>>> 
>>> The failed tests seem to be caused by the already reported bug where
>>> certain operations fail if BZREMAIL or EMAIL aren't set.
>>
>>Yes, they do.  The test framework is such that there can be a  lot of
>>cascading failures if something goes wrong.
>>
>>I will take in the patch for it shortly.
>
>In case you didn't get around to creating a patch yet I've attached one
>that makes the tests pass.

I think this patch feels a little better.

/M

-- 
Magnus Therning                    (OpenPGP: 0xAB4DFBA4)
magnus at therning.org
http://magnus.therning.org/

Software is not manufactured, it is something you write and publish.
Keep Europe free from software patents, we do not want censorship
by patent law on written works.

Action is the foundational key to all success.
     -- Pablo Picasso
-------------- next part --------------
Index: bazaar-ng/my.dev/bzrlib/osutils.py
===================================================================
--- bazaar-ng.orig/my.dev/bzrlib/osutils.py	2005-04-14 10:33:42.523825267 +0100
+++ bazaar-ng/my.dev/bzrlib/osutils.py	2005-04-14 11:01:16.932362071 +0100
@@ -16,7 +16,7 @@
 # along with this program; if not, write to the Free Software
 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
-import os, types, re, time
+import os, types, re, time, locale
 from stat import S_ISREG, S_ISDIR, S_ISLNK, ST_MODE, ST_SIZE
 
 from errors import bailout, BzrError
@@ -174,7 +174,6 @@
     TODO: Allow taking it from a dotfile to help people on windows
            who can't easily set variables.
     """
-    import locale
     e = os.environ.get('BZREMAIL') or os.environ.get('EMAIL')
     if e:
         return e.decode(locale.getpreferredencoding())
@@ -190,9 +189,8 @@
 def user_email():
     """Return just the email component of a username."""
     e = os.environ.get('BZREMAIL') or os.environ.get('EMAIL')
-    import locale
-    e = e.decode(locale.getpreferredencoding())
     if e:
+        e = e.decode(locale.getpreferredencoding())
         m = _EMAIL_RE.search(e)
         if not m:
             bailout('%r is not a reasonable email address' % e)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20050414/091e0586/attachment.pgp 


More information about the bazaar mailing list