##// END OF EJS Templates
wireprotov2: implement commands as a generator of objects...
wireprotov2: implement commands as a generator of objects Previously, wire protocol version 2 inherited version 1's model of having separate types to represent the results of different wire protocol commands. As I implemented more powerful commands in future commits, I found I was using a common pattern of returning a special type to hold a generator. This meant the command function required a closure to do most of the work. That made logic flow more difficult to follow. I also noticed that many commands were effectively a sequence of objects to be CBOR encoded. I think it makes sense to define version 2 commands as generators. This way, commands can simply emit the data structures they wish to send to the client. This eliminates the need for a closure in command functions and removes encoding from the bodies of commands. As part of this commit, the handling of response objects has been moved into the serverreactor class. This puts the reactor in the driver's seat with regards to CBOR encoding and error handling. Having error handling in the function that emits frames is particularly important because exceptions in that function can lead to things getting in a bad state: I'm fairly certain that uncaught exceptions in the frame generator were causing deadlocks. I also introduced a dedicated error type for explicit error reporting in command handlers. This will be used in subsequent commits. There's still a bit of work to be done here, especially around formalizing the error handling "protocol." I've added yet another TODO to track this so we don't forget. Test output changed because we're using generators and no longer know we are at the end of the data until we hit the end of the generator. This means we can't emit the end-of-stream flag until we've exhausted the generator. Hence the introduction of 0-sized end-of-stream frames. Differential Revision: https://phab.mercurial-scm.org/D4472

File last commit:

r36663:7bc33d67 default
r39595:07b58266 default
Show More
test-i18n.t
74 lines | 2.0 KiB | text/troff | Tads3Lexer
Matt Mackall
tests: replace exit 80 with #require
r22046 (Translations are optional)
Martin Geisler
test-i18n: make test conditional on msgfmt availability
r13442
timeless@mozdev.org
test-i18n: always run non gettext tests
r26252 #if gettext no-outer-repo
Mads Kiilerich
tests: add missing no-outer-repo requirements...
r17015
Martin Geisler
test-i18n: test translations
r13414 Test that translations are compiled and installed correctly.
Default encoding in tests is "ascii" and the translation is encoded
using the "replace" error handler:
$ LANGUAGE=pt_BR hg tip
Wagner Bruna
test-i18n, i18n-pt_BR: updated test message changed in 41c3a71c318d
r14920 abortado: n?o foi encontrado um reposit?rio em '$TESTTMP' (.hg n?o encontrado)!
Martin Geisler
test-i18n: test translations
r13414 [255]
Mads Kiilerich
spelling: fixes from spell checker
r21024 Using a more accommodating encoding:
Martin Geisler
test-i18n: test translations
r13414
$ HGENCODING=UTF-8 LANGUAGE=pt_BR hg tip
Wagner Bruna
test-i18n, i18n-pt_BR: updated test message changed in 41c3a71c318d
r14920 abortado: n\xc3\xa3o foi encontrado um reposit\xc3\xb3rio em '$TESTTMP' (.hg n\xc3\xa3o encontrado)! (esc)
Martin Geisler
test-i18n: test translations
r13414 [255]
Different encoding:
$ HGENCODING=Latin-1 LANGUAGE=pt_BR hg tip
Wagner Bruna
test-i18n, i18n-pt_BR: updated test message changed in 41c3a71c318d
r14920 abortado: n\xe3o foi encontrado um reposit\xf3rio em '$TESTTMP' (.hg n\xe3o encontrado)! (esc)
Martin Geisler
test-i18n: test translations
r13414 [255]
Olav Reinert
help: test keyword search in translated text....
r16895
Mads Kiilerich
tests: add missing no-outer-repo requirements...
r17015 #endif
timeless@mozdev.org
test-i18n: always run non gettext tests
r26252 #if gettext
Olav Reinert
help: test keyword search in translated text....
r16895 Test keyword search in translated help text:
Augie Fackler
tests: update test-i18n.t to not depend on the pager extension...
r30943 $ HGENCODING=UTF-8 LANGUAGE=de hg help -k Aktualisiert
Simon Heimberg
i18n-de: update many fuzzy entries and translate some simple ones...
r20338 Themen:
Olav Reinert
help: test keyword search in translated text....
r16895
Augie Fackler
tests: update test-i18n.t to not depend on the pager extension...
r30943 subrepos Unterarchive
Olav Reinert
help: test keyword search in translated text....
r16895
Augie Fackler
tests: update test-i18n.t to not depend on the pager extension...
r30943 Befehle:
Olav Reinert
help: test keyword search in translated text....
r16895
Augie Fackler
tests: update test-i18n.t to not depend on the pager extension...
r30943 pull Ruft \xc3\x84nderungen von der angegebenen Quelle ab (esc)
update Aktualisiert das Arbeitsverzeichnis (oder wechselt die Version)
Olav Reinert
help: test keyword search in translated text....
r16895
timeless@mozdev.org
test-i18n: always run non gettext tests
r26252 #endif
FUJIWARA Katsunori
i18n: add the tool to check Mercurial specific translation problems in *.po...
r20152 Check Mercurial specific translation problems in each *.po files, and
tool itself by doctest
$ cd "$TESTDIR"/../i18n
Augie Fackler
cleanup: use $PYTHON to run python in many more tests...
r32940 $ $PYTHON check-translation.py *.po
$ $PYTHON check-translation.py --doctest
FUJIWARA Katsunori
i18n: add the tool to check Mercurial specific translation problems in *.po...
r20152 $ cd $TESTTMP
Yuya Nishihara
i18n: cache translated messages per encoding...
r34661
Yuya Nishihara
test-i18n: guard gettext test appropriately
r34689 #if gettext
Yuya Nishihara
i18n: cache translated messages per encoding...
r34661 Check i18n cache isn't reused after encoding change:
$ cat > $TESTTMP/encodingchange.py << EOF
Augie Fackler
tests: fix various test-check-module-imports.t violations...
r36663 > from mercurial.i18n import _
Yuya Nishihara
i18n: cache translated messages per encoding...
r34661 > from mercurial import encoding, registrar
> cmdtable = {}
> command = registrar.command(cmdtable)
> @command(b'encodingchange', norepo=True)
> def encodingchange(ui):
> for encode in (b'ascii', b'UTF-8', b'ascii', b'UTF-8'):
> encoding.encoding = encode
> ui.write(b'%s\n' % _(b'(EXPERIMENTAL)'))
> EOF
$ LANGUAGE=ja hg --config extensions.encodingchange=$TESTTMP/encodingchange.py encodingchange
(?????)
(\xe5\xae\x9f\xe9\xa8\x93\xe7\x9a\x84\xe5\xae\x9f\xe8\xa3\x85) (esc)
(?????)
(\xe5\xae\x9f\xe9\xa8\x93\xe7\x9a\x84\xe5\xae\x9f\xe8\xa3\x85) (esc)
Yuya Nishihara
test-i18n: guard gettext test appropriately
r34689
#endif