Merge lp:~mbp/bzr/340394-encoding-option into lp:bzr
| Status: | Merged |
|---|---|
| Approved by: | John A Meinel on 2010-06-18 |
| Approved revision: | 5235 |
| Merged at revision: | 5317 |
| Proposed branch: | lp:~mbp/bzr/340394-encoding-option |
| Merge into: | lp:bzr |
| Diff against target: |
244 lines (+153/-3) 7 files modified
NEWS (+3/-0) bzrlib/help_topics/en/configuration.txt (+11/-0) bzrlib/tests/__init__.py (+2/-0) bzrlib/tests/fixtures.py (+84/-0) bzrlib/tests/test_fixtures.py (+28/-0) bzrlib/tests/test_ui.py (+18/-1) bzrlib/ui/__init__.py (+7/-2) |
| To merge this branch: | bzr merge lp:~mbp/bzr/340394-encoding-option |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Robert Collins (community) | Needs Information on 2010-06-20 | ||
| John A Meinel | 2010-06-18 | Approve on 2010-06-18 | |
|
Review via email:
|
|||
Description of the Change
This is probably a bit out of date with other test changes, but I'll put it up so bialix can see it: it adds an output_encoding config option that controls how we encode non-file-content output. My next step was going to be to add a way to set this on the command line for the duration of a process.
| Robert Collins (lifeless) wrote : | # |
This doesn't make sense: why would we want to have an output encoding that isn't compatible with the operating systems encoding? I'm channelling Martin[gz] here I think - I recall him asking this question in IRC, and I think its a good question.
| John A Meinel (jameinel) wrote : | # |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Robert Collins wrote:
> Review: Needs Information
> This doesn't make sense: why would we want to have an output encoding that isn't compatible with the operating systems encoding? I'm channelling Martin[gz] here I think - I recall him asking this question in IRC, and I think its a good question.
Incorrect auto-detection. (Fairly common, Mac hasn't traditionally
detected well, neither FreeBSD, etc.)
Output to a file.
bzr log | less
vs
bzr log > content.txt
(On Windows, the former should probably use Terminal encoding, but the
later should use locale.
I think the big thing is having this as a step along the way to being
able to supply it on a per-command basis.
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://
iEYEARECAAYFAkw
3B8AoI06keflVw9
=DM/S
-----END PGP SIGNATURE-----
| Robert Collins (lifeless) wrote : | # |
That seems to be coupled to the as yet untackled command-
The fixtures file is pretty rudimentary now but we can iterate.
| Robert Collins (lifeless) wrote : | # |
Oh, one more thing of interest - I'm not sure 'Unicode options' is the best name for this in the help, but I can't think of a better one right now.
I'm proposing a fixed branch with NEWS entries and correct copyright years now; would appreciate a rubber stamp on it.
| Alexander Belchenko (bialix) wrote : | # |
John A Meinel пишет:
> Robert Collins wrote:
>> Review: Needs Information
>> This doesn't make sense: why would we want to have an output encoding that isn't compatible with the operating systems encoding? I'm channelling Martin[gz] here I think - I recall him asking this question in IRC, and I think its a good question.
>
> Incorrect auto-detection. (Fairly common, Mac hasn't traditionally
> detected well, neither FreeBSD, etc.)
>
> Output to a file.
>
> bzr log | less
> vs
> bzr log > content.txt
>
> (On Windows, the former should probably use Terminal encoding, but the
> later should use locale.
Exactly.
> I think the big thing is having this as a step along the way to being
> able to supply it on a per-command basis.
On UDS I've talked with Martin and proposed global command-line option
--encoding for this, e.g.:
bzr --encoding utf-8 log > file.txt
But if this patch is the first step towards this goal, it's ok.
| Martin Pool (mbp) wrote : | # |
On 21 June 2010 23:44, John Arbash Meinel <email address hidden> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Robert Collins wrote:
>> Review: Needs Information
>> This doesn't make sense: why would we want to have an output encoding that isn't compatible with the operating systems encoding? I'm channelling Martin[gz] here I think - I recall him asking this question in IRC, and I think its a good question.
>
> Incorrect auto-detection. (Fairly common, Mac hasn't traditionally
> detected well, neither FreeBSD, etc.)
It is a good question. Beyond the cases John mentions I just might
want the output in some arbitrary encoding: I might always work in
8859-7 but want to export a diff as utf-8 to attach it to a Launchpad
bug.
--
Martin
| Robert Collins (lifeless) wrote : | # |
On Tue, Jun 22, 2010 at 6:58 PM, Martin Pool <email address hidden> wrote:
>> Incorrect auto-detection. (Fairly common, Mac hasn't traditionally
>> detected well, neither FreeBSD, etc.)
>
> It is a good question. Beyond the cases John mentions I just might
> want the output in some arbitrary encoding: I might always work in
> 8859-7 but want to export a diff as utf-8 to attach it to a Launchpad
> bug.
I don't see that particular one as relevant because the OS
autodetection permits changing that via the existing standard
environment variables already - or am I missing something? [possibly
the variables are too big a hammer and the diff won't generate from
disk correctly if the variables are changed?]
| John A Meinel (jameinel) wrote : | # |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Robert Collins wrote:
> On Tue, Jun 22, 2010 at 6:58 PM, Martin Pool <email address hidden> wrote:
>>> Incorrect auto-detection. (Fairly common, Mac hasn't traditionally
>>> detected well, neither FreeBSD, etc.)
>> It is a good question. Beyond the cases John mentions I just might
>> want the output in some arbitrary encoding: I might always work in
>> 8859-7 but want to export a diff as utf-8 to attach it to a Launchpad
>> bug.
>
> I don't see that particular one as relevant because the OS
> autodetection permits changing that via the existing standard
> environment variables already - or am I missing something? [possibly
> the variables are too big a hammer and the diff won't generate from
> disk correctly if the variables are changed?]
You can't set utf-8 as the codepage? (I believe you can only set 8-bit
code pages for the shell on Windows)
John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://
iEYEARECAAYFAkw
0z4AoLuawZMpxli
=KNBS
-----END PGP SIGNATURE-----
| Robert Collins (lifeless) wrote : | # |
Ah! anyhow, as said above, lets merge it.
| Martin Pool (mbp) wrote : | # |
On 23 June 2010 05:01, Robert Collins <email address hidden> wrote:
> On Tue, Jun 22, 2010 at 6:58 PM, Martin Pool <email address hidden> wrote:
>>> Incorrect auto-detection. (Fairly common, Mac hasn't traditionally
>>> detected well, neither FreeBSD, etc.)
>>
>> It is a good question. Beyond the cases John mentions I just might
>> want the output in some arbitrary encoding: I might always work in
>> 8859-7 but want to export a diff as utf-8 to attach it to a Launchpad
>> bug.
>
> I don't see that particular one as relevant because the OS
> autodetection permits changing that via the existing standard
> environment variables already - or am I missing something? [possibly
> the variables are too big a hammer and the diff won't generate from
> disk correctly if the variables are changed?]
It's a few things:
* eventually I want to have a command line option that rebinds these
variables for the scope of a process
* I'm not sure if it's easy to change this from the windows command line
* OS autodetection is sometimes wrong
* you might want to set things on a finer granularity, for example
the unix path encoding, and these are not well exposed
--
Martin

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Martin Pool wrote:
> Martin Pool has proposed merging lp:~mbp/bzr/340394-encoding-option into lp:bzr.
>
> Requested reviews:
> bzr-core (bzr-core)
>
>
> This is probably a bit out of date with other test changes, but I'll put it up so bialix can see it: it adds an output_encoding config option that controls how we encode non-file-content output. My next step was going to be to add a way to set this on the command line for the duration of a process.
>
=== modified file 'bzrlib/ tests/_ _init__ .py' tests/_ _init__ .py 2010-06-08 01:42:50 +0000 tests/_ _init__ .py 2010-06-18 09:45:47 +0000
'bzrlib. tests.test_ export' ,
'bzrlib. tests.test_ extract' ,
'bzrlib. tests.test_ fetch', tests.test_ fixtures' ,
'bzrlib. tests.test_ fifo_cache' ,
'bzrlib. tests.test_ filters' ,
'bzrlib. tests.test_ ftp_transport' ,
'bzrlib. option' ,
'bzrlib. symbol_ versioning' ,
'bzrlib. tests', tests.fixtures' ,
'bzrlib. timestamp' ,
'bzrlib. version_ info_formats. format_ custom' ,
- --- bzrlib/
+++ bzrlib/
@@ -3704,6 +3704,7 @@
+ 'bzrlib.
@@ -3839,6 +3840,7 @@
+ 'bzrlib.
]
^- This confused me at first, but I see that it is "tests. test_fixtures"
versus "tests.fixtures". Probably fine overall, just mentioning the
confusion.
=== added file 'bzrlib/ tests/test_ fixtures. py' tests/test_ fixtures. py 1970-01-01 00:00:00 +0000 tests/test_ fixtures. py 2010-06-18 09:45:47 +0000
- --- bzrlib/
+++ bzrlib/
@@ -0,0 +1,28 @@
+# Copyright (C) 2005-2010 Canonical Ltd
^- I'm pretty sure this isn't accurate :).
+class TestUIConfigura tion(tests. TestCaseWithTra nsport) : encoding_ configuration( self): generate_ unicode_ encodings( ).next( ) GlobalConfig( ).set_user_ option( 'output_ encoding' , tory(stdin= None, tests.StringIOW rapper( ), tests.StringIOW rapper( )) output_ stream( ) ls(os.encoding, enc)
+
+ def test_output_
+ enc = fixtures.
+ config.
+ enc)
+ ui = tests.TestUIFac
+ stdout=
+ stderr=
+ os = ui.make_
+ self.assertEqua
+
+
^- this seems like it would want to be a permutation test across all the unicode_ encodings( )' rather than a single test of the first one.
'generate_
Conceptually I'm fine with this. I think it is a reasonable way to
handle stuff like "I want utf-8 always, even though my system doesn't
think so."
merge: approve
John
=:->
-----BEGIN PGP SIGNATURE----- enigmail. mozdev. org/
bgo4ACgkQJdeBCY SNAANGdQCghkA48 qKjGt9reS13FkE8 e2bK dcKauNFwhfss15X Tn
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://
iEYEARECAAYFAkw
ydAAoJZYizvZDCt
=4eZG
-----END PGP SIGNATURE-----