Mercurial > hg
view tests/test-audit-subrepo.t @ 36534:5faeabb07cf5
debugcommands: support for triggering push protocol
The mechanism for pushing to a remote is a bit more complicated
than other commands. On SSH, we wait for a positive reply from
the server before we start sending the bundle payload.
This commit adds a mechanism to the "command" action in
`hg debugwireproto` to trigger the "push protocol" and to
specify a file whose contents should be submitted as the command
payload.
With this new feature, we implement a handful of tests for the
"unbundle" command. We try to cover various server failures and
hook/output scenarios so protocol behavior is as comprehensively
tested as possible. Even with so much test output, we only cover
bundle1 with Python hooks. There's still a lot of test coverage
that needs to be implemented. But this is certainly a good start.
Because there are so many new tests, we split these tests into their
own test file.
In order to make output deterministic, we need to disable the
doublepipe primitive. We add an option to `hg debugwireproto`
to do that. Because something in the bowels of the peer does a
read of stderr, we still capture read I/O from stderr. So there
is test coverage of what the server emits.
The tests around I/O capture some wonkiness. For example,
interleaved ui.write() and ui.write_err() calls are emitted in
order. However, (presumably due to buffering), print() to
sys.stdout and sys.stderr aren't in order.
We currently only test bundle1 because bundle2 is substantially
harder to test because it is more complicated (the server responds
with a stream containing a bundle2 instead of a frame).
Differential Revision: https://phab.mercurial-scm.org/D2471
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Mon, 26 Feb 2018 18:01:13 -0800 |
parents | 4441705b7111 |
children | 31286c9282df |
line wrap: on
line source
Test illegal name ----------------- on commit: $ hg init hgname $ cd hgname $ mkdir sub $ hg init sub/.hg $ echo 'sub/.hg = sub/.hg' >> .hgsub $ hg ci -qAm 'add subrepo "sub/.hg"' abort: path 'sub/.hg' is inside nested repo 'sub' [255] prepare tampered repo (including the commit above): $ hg import --bypass -qm 'add subrepo "sub/.hg"' - <<'EOF' > diff --git a/.hgsub b/.hgsub > new file mode 100644 > --- /dev/null > +++ b/.hgsub > @@ -0,0 +1,1 @@ > +sub/.hg = sub/.hg > diff --git a/.hgsubstate b/.hgsubstate > new file mode 100644 > --- /dev/null > +++ b/.hgsubstate > @@ -0,0 +1,1 @@ > +0000000000000000000000000000000000000000 sub/.hg > EOF $ cd .. on clone (and update): $ hg clone -q hgname hgname2 abort: path 'sub/.hg' is inside nested repo 'sub' [255] Test direct symlink traversal ----------------------------- #if symlink on commit: $ mkdir hgsymdir $ hg init hgsymdir/root $ cd hgsymdir/root $ ln -s ../out $ hg ci -qAm 'add symlink "out"' $ hg init ../out $ echo 'out = out' >> .hgsub $ hg ci -qAm 'add subrepo "out"' abort: subrepo 'out' traverses symbolic link [255] prepare tampered repo (including the commit above): $ hg import --bypass -qm 'add subrepo "out"' - <<'EOF' > diff --git a/.hgsub b/.hgsub > new file mode 100644 > --- /dev/null > +++ b/.hgsub > @@ -0,0 +1,1 @@ > +out = out > diff --git a/.hgsubstate b/.hgsubstate > new file mode 100644 > --- /dev/null > +++ b/.hgsubstate > @@ -0,0 +1,1 @@ > +0000000000000000000000000000000000000000 out > EOF $ cd ../.. on clone (and update): $ mkdir hgsymdir2 $ hg clone -q hgsymdir/root hgsymdir2/root abort: subrepo 'out' traverses symbolic link [255] $ ls hgsymdir2 root #endif Test indirect symlink traversal ------------------------------- #if symlink on commit: $ mkdir hgsymin $ hg init hgsymin/root $ cd hgsymin/root $ ln -s ../out $ hg ci -qAm 'add symlink "out"' $ mkdir ../out $ hg init ../out/sub $ echo 'out/sub = out/sub' >> .hgsub $ hg ci -qAm 'add subrepo "out/sub"' abort: path 'out/sub' traverses symbolic link 'out' [255] prepare tampered repo (including the commit above): $ hg import --bypass -qm 'add subrepo "out/sub"' - <<'EOF' > diff --git a/.hgsub b/.hgsub > new file mode 100644 > --- /dev/null > +++ b/.hgsub > @@ -0,0 +1,1 @@ > +out/sub = out/sub > diff --git a/.hgsubstate b/.hgsubstate > new file mode 100644 > --- /dev/null > +++ b/.hgsubstate > @@ -0,0 +1,1 @@ > +0000000000000000000000000000000000000000 out/sub > EOF $ cd ../.. on clone (and update): $ mkdir hgsymin2 $ hg clone -q hgsymin/root hgsymin2/root abort: path 'out/sub' traverses symbolic link 'out' [255] $ ls hgsymin2 root #endif