##// END OF EJS Templates
wireprotov2: define and implement "manifestdata" command...
wireprotov2: define and implement "manifestdata" command The added command can be used for obtaining manifest data. Given a manifest path and set of manifest nodes, data about manifests can be retrieved. Unlike changeset data, we wish to emit deltas to describe manifest revisions. So the command uses the relatively new API for building delta requests and emitting them. The code calls into deltaparent(), which I'm not very keen of. There's still work to be done in delta generation land so implementation details of storage (e.g. exactly one delta is stored/available) don't creep into higher levels. But we can worry about this later (there is already a TODO on imanifestorage tracking this). On the subject of parent deltas, the server assumes parent revisions exist on the receiving end. This is obviously wrong for shallow clone. I've added TODOs to add a mechanism to the command to allow clients to specify desired behavior. This shouldn't be too difficult to implement. Another big change is that the client must explicitly request manifest nodes to retrieve. This is a major departure from "getbundle," where the server derives relevant manifests as it iterates changesets and sends them automatically. As implemented, the client must transmit each requested node to the server. At 20 bytes per node, we're looking at 2 MB per 100,000 nodes. Plus wire encoding overhead. This isn't ideal for clients with limited upload bandwidth. I plan to address this in the future by allowing alternate mechanisms for defining the revisions to retrieve. One idea is to define a range of changeset revisions whose manifest revisions to retrieve (similar to how "changesetdata" works). We almost certainly want an API to look up an individual manifest by node. And that's where I've chosen to start with the implementation. Again, a theme of this early exchangev2 work is I want to start by building primitives for accessing raw repository data first and see how far we can get with those before we need more complexity. Differential Revision: https://phab.mercurial-scm.org/D4488

File last commit:

r34765:af43cb56 default
r39673:c7a7c7e8 default
Show More
test-logtoprocess.t
85 lines | 2.2 KiB | text/troff | Tads3Lexer
/ tests / test-logtoprocess.t
Matt Harbison
test-logtoprocess: don't run on Windows...
r32915 #require no-windows
Jun Wu
test-logtoprocess: use cat to wait for outputs...
r30991 ATTENTION: logtoprocess runs commands asynchronously. Be sure to append "| cat"
to hg commands, to wait for the output, if you want to test its output.
Otherwise the test will be flaky.
Martijn Pieters
logtoprocess: new experimental extension...
r28901 Test if logtoprocess correctly captures command-related log calls.
$ hg init
$ cat > $TESTTMP/foocommand.py << EOF
Augie Fackler
tests: update test-logtoprocess to pass our import checker
r33968 > from __future__ import absolute_import
Yuya Nishihara
registrar: move cmdutil.command to registrar module (API)...
r32337 > from mercurial import registrar
Martijn Pieters
logtoprocess: new experimental extension...
r28901 > cmdtable = {}
Yuya Nishihara
registrar: move cmdutil.command to registrar module (API)...
r32337 > command = registrar.command(cmdtable)
Boris Feld
configitems: register the test 'logtoprocess.foo' config
r34765 > configtable = {}
> configitem = registrar.configitem(configtable)
> configitem('logtoprocess', 'foo',
> default=None,
> )
Pulkit Goyal
py3: make sure commands name are bytes in tests
r33097 > @command(b'foo', [])
Martijn Pieters
logtoprocess: new experimental extension...
r28901 > def foo(ui, repo):
> ui.log('foo', 'a message: %(bar)s\n', bar='spam')
> EOF
Simon Farnsworth
ui: provide a mechanism to track and log blocked time...
r30976 $ cp $HGRCPATH $HGRCPATH.bak
Martijn Pieters
logtoprocess: new experimental extension...
r28901 $ cat >> $HGRCPATH << EOF
> [extensions]
> logtoprocess=
> foocommand=$TESTTMP/foocommand.py
> [logtoprocess]
> command=echo 'logtoprocess command output:';
> echo "\$EVENT";
> echo "\$MSG1";
> echo "\$MSG2"
> commandfinish=echo 'logtoprocess commandfinish output:';
> echo "\$EVENT";
> echo "\$MSG1";
> echo "\$MSG2";
> echo "\$MSG3"
> foo=echo 'logtoprocess foo output:';
> echo "\$EVENT";
> echo "\$MSG1";
> echo "\$OPT_BAR"
> EOF
Running a command triggers both a ui.log('command') and a
ui.log('commandfinish') call. The foo command also uses ui.log.
Jun Wu
test-logtoprocess: use cat to wait for outputs...
r30991 Use sort to avoid ordering issues between the various processes we spawn:
$ hg foo | cat | sort
Martijn Pieters
logtoprocess: new experimental extension...
r28901
Jun Wu
test-logtoprocess: make it compatible with chg...
r34445 (chg !)
Martijn Pieters
logtoprocess: new experimental extension...
r28901 0
a message: spam
command
Jun Wu
test-logtoprocess: make it compatible with chg...
r34445 command (chg !)
Martijn Pieters
logtoprocess: new experimental extension...
r28901 commandfinish
foo
foo
foo
foo
foo exited 0 after * seconds (glob)
logtoprocess command output:
Jun Wu
test-logtoprocess: make it compatible with chg...
r34445 logtoprocess command output: (chg !)
Martijn Pieters
logtoprocess: new experimental extension...
r28901 logtoprocess commandfinish output:
logtoprocess foo output:
Jun Wu
test-logtoprocess: make it compatible with chg...
r34445 serve --cmdserver chgunix * (glob) (chg !)
serve --cmdserver chgunix * (glob) (chg !)
Martijn Pieters
logtoprocess: new experimental extension...
r28901 spam
Simon Farnsworth
ui: provide a mechanism to track and log blocked time...
r30976
Confirm that logging blocked time catches stdio properly:
$ cp $HGRCPATH.bak $HGRCPATH
$ cat >> $HGRCPATH << EOF
> [extensions]
> logtoprocess=
> pager=
> [logtoprocess]
Simon Farnsworth
ui: log time spent blocked on stdio...
r30978 > uiblocked=echo "\$EVENT stdio \$OPT_STDIO_BLOCKED ms command \$OPT_COMMAND_DURATION ms"
Simon Farnsworth
ui: provide a mechanism to track and log blocked time...
r30976 > [ui]
> logblockedtimes=True
> EOF
Jun Wu
test-logtoprocess: use cat to wait for outputs...
r30991 $ hg log | cat
Simon Farnsworth
ui: log time spent blocked on stdio...
r30978 uiblocked stdio [0-9]+.[0-9]* ms command [0-9]+.[0-9]* ms (re)