tests/test-encoding.out
author Edouard Gomez <ed.gomez@free.fr>
Sat, 12 May 2007 00:41:30 +0200
changeset 4834 439e2f2fde42
parent 4675 6858a7477a5e
child 4970 30d4d8985dd8
permissions -rw-r--r--
Fix inconsistency for the stream_out capability in hgweb During some experiments of mine, the uncompressed cloning could not be enabled for hgweb.cgi nor hgwebdir.cgi though the server claimed to be stream_out capable. The only solution was to enable it using the user's .hgrc file. This solution is not acceptable when publishing the repos through an HTTP server because the CGI runs as a www dedicated user whose's home hgrc file may not be accessible to users publishing their repos through their userdir. For such cases we could end up with this typical debug output: hg --debug clone --uncompressed http://server/hg/project destination directory: project sending capabilities command capabilities: lookup changegroupsubset stream=1 unbundle=HG10GZ,HG10BZ,HG10UN sending stream_out command abort: operation forbidden by server The error lies in the fact the hgweb object defines new accessors to the repo configuration that trust things by default (untrusted=True) but the streamclone:stream_out function uses the usual accessors to the repo.ui object, which do not trust by default (untrusted=False) Fix this inconsistency, adding a new parameter to the stream_out function. hgweb then forces a "trust by default" behavior.

adding changesets
adding manifests
adding file changes
added 2 changesets with 2 changes to 1 files
(run 'hg update' to get a working copy)
1 files updated, 0 files merged, 0 files removed, 0 files unresolved
% should fail with encoding error
M a
? latin-1
? latin-1-tag
? utf-8
abort: decoding near ' encoded: é': 'ascii' codec can't decode byte 0xe9 in position 20: ordinal not in range(128)!
transaction abort!
rollback completed
% these should work
marked working directory as branch é
% ascii
changeset:   5:db5520b4645f
branch:      ?
tag:         tip
user:        test
date:        Mon Jan 12 13:46:40 1970 +0000
summary:     latin1 branch

changeset:   4:9cff3c980b58
user:        test
date:        Mon Jan 12 13:46:40 1970 +0000
summary:     Added tag ? for changeset 770b9b11621d

changeset:   3:770b9b11621d
tag:         ?
user:        test
date:        Mon Jan 12 13:46:40 1970 +0000
summary:     utf-8 e' encoded: ?

changeset:   2:0572af48b948
user:        test
date:        Mon Jan 12 13:46:40 1970 +0000
summary:     latin-1 e' encoded: ?

changeset:   1:0e5b7e3f9c4a
user:        test
date:        Mon Jan 12 13:46:40 1970 +0000
summary:     koi8-r: ????? = u'\u0440\u0442\u0443\u0442\u044c'

changeset:   0:1e78a93102a3
user:        test
date:        Mon Jan 12 13:46:40 1970 +0000
summary:     latin-1 e': ? = u'\xe9'

% latin-1
changeset:   5:db5520b4645f
branch:      é
tag:         tip
user:        test
date:        Mon Jan 12 13:46:40 1970 +0000
summary:     latin1 branch

changeset:   4:9cff3c980b58
user:        test
date:        Mon Jan 12 13:46:40 1970 +0000
summary:     Added tag é for changeset 770b9b11621d

changeset:   3:770b9b11621d
tag:         é
user:        test
date:        Mon Jan 12 13:46:40 1970 +0000
summary:     utf-8 e' encoded: é

changeset:   2:0572af48b948
user:        test
date:        Mon Jan 12 13:46:40 1970 +0000
summary:     latin-1 e' encoded: é

changeset:   1:0e5b7e3f9c4a
user:        test
date:        Mon Jan 12 13:46:40 1970 +0000
summary:     koi8-r: ÒÔÕÔØ = u'\u0440\u0442\u0443\u0442\u044c'

changeset:   0:1e78a93102a3
user:        test
date:        Mon Jan 12 13:46:40 1970 +0000
summary:     latin-1 e': é = u'\xe9'

% utf-8
changeset:   5:db5520b4645f
branch:      é
tag:         tip
user:        test
date:        Mon Jan 12 13:46:40 1970 +0000
summary:     latin1 branch

changeset:   4:9cff3c980b58
user:        test
date:        Mon Jan 12 13:46:40 1970 +0000
summary:     Added tag é for changeset 770b9b11621d

changeset:   3:770b9b11621d
tag:         é
user:        test
date:        Mon Jan 12 13:46:40 1970 +0000
summary:     utf-8 e' encoded: é

changeset:   2:0572af48b948
user:        test
date:        Mon Jan 12 13:46:40 1970 +0000
summary:     latin-1 e' encoded: é

changeset:   1:0e5b7e3f9c4a
user:        test
date:        Mon Jan 12 13:46:40 1970 +0000
summary:     koi8-r: ÒÔÕÔØ = u'\u0440\u0442\u0443\u0442\u044c'

changeset:   0:1e78a93102a3
user:        test
date:        Mon Jan 12 13:46:40 1970 +0000
summary:     latin-1 e': é = u'\xe9'

% ascii
tip                                5:db5520b4645f
?                                  3:770b9b11621d
% latin-1
tip                                5:db5520b4645f
é                                  3:770b9b11621d
% utf-8
tip                                5:db5520b4645f
é                                  3:770b9b11621d
% ascii
?                              5:db5520b4645f
default                        4:9cff3c980b58 (inactive)
% latin-1
é                              5:db5520b4645f
default                        4:9cff3c980b58 (inactive)
% utf-8
é                              5:db5520b4645f
default                        4:9cff3c980b58 (inactive)
% utf-8
changeset:   5:db5520b4645f
branch:      é
tag:         tip
user:        test
date:        Mon Jan 12 13:46:40 1970 +0000
summary:     latin1 branch

changeset:   4:9cff3c980b58
user:        test
date:        Mon Jan 12 13:46:40 1970 +0000
summary:     Added tag é for changeset 770b9b11621d

changeset:   3:770b9b11621d
tag:         é
user:        test
date:        Mon Jan 12 13:46:40 1970 +0000
summary:     utf-8 e' encoded: é

changeset:   2:0572af48b948
user:        test
date:        Mon Jan 12 13:46:40 1970 +0000
summary:     latin-1 e' encoded: é

changeset:   1:0e5b7e3f9c4a
user:        test
date:        Mon Jan 12 13:46:40 1970 +0000
summary:     koi8-r: ртуть = u'\u0440\u0442\u0443\u0442\u044c'

changeset:   0:1e78a93102a3
user:        test
date:        Mon Jan 12 13:46:40 1970 +0000
summary:     latin-1 e': И = u'\xe9'

abort: unknown encoding: dolphin, please check your locale settings
abort: decoding near 'é': 'ascii' codec can't decode byte 0xe9 in position 0: ordinal not in range(128)!
abort: branch name not in UTF-8!