##// END OF EJS Templates
sshpeer: initial definition and implementation of new SSH protocol...
sshpeer: initial definition and implementation of new SSH protocol The existing SSH protocol has several design flaws. Future commits will elaborate on these flaws as new features are introduced to combat these flaws. For now, hopefully you can take me for my word that a ground up rewrite of the SSH protocol is needed. This commit lays the foundation for a new SSH protocol by defining a mechanism to upgrade the SSH transport channel away from the default (version 1) protocol to something modern (which we'll call "version 2" for now). This upgrade process is detailed in the internals documentation for the wire protocol. The gist of it is the client sends a request line preceding the "hello" command/line which basically says "I'm requesting an upgrade: here's what I support." If the server recognizes that line, it processes the upgrade request and the transport channel is switched to use the new version of the protocol. If not, it sends an empty response, which is how all Mercurial SSH servers from the beginning of time reacted to unknown commands. The upgrade request is effectively ignored and the client continues to use the existing version of the protocol as if nothing happened. The new version of the SSH protocol is completely identical to version 1 aside from the upgrade dance and the bytes that follow. The immediate bytes that follow the protocol switch are defined to be a length framed "capabilities: " line containing the remote's advertised capabilities. In reality, this looks very similar to what the "hello" response would look like. But it will evolve quickly. The methodology by which the protocol will evolve is important. I'm not going to introduce the new protocol all at once. That would likely lead to endless bike shedding and forward progress would stall. Instead, I intend to tricle out new features and diversions from the existing protocol in small, incremental changes. To support the gradual evolution of the protocol, the on-the-wire advertised protocol name contains an "exp" to denote "experimental" and a 4 digit field to capture the sub-version of the protocol. Whenever we make a BC change to the wire protocol, we can increment this version and lock out all older clients because it will appear as a completely different protocol version. This means we can incur as many breaking changes as we want. We don't have to commit to supporting any one feature or idea for a long period of time. We can even evolve the handshake mechanism, because that is defined as being an implementation detail of the negotiated protocol version! Hopefully this lowers the barrier to accepting changes to the protocol and for experimenting with "radical" ideas during its development. In core, sshpeer received most of the attention. We haven't even implemented the server bits for the new protocol in core yet. Instead, we add very primitive support to our test server, mainly just to exercise the added code paths in sshpeer. Differential Revision: https://phab.mercurial-scm.org/D2061 # no-check-commit because of required foo_bar naming

File last commit:

r35727:1a09dad8 default
r35994:48a3a928 default
Show More
test-drawdag.t
273 lines | 4.4 KiB | text/troff | Tads3Lexer
$ cat >> $HGRCPATH<<EOF
> [extensions]
> drawdag=$TESTDIR/drawdag.py
> [experimental]
> evolution=true
> EOF
$ reinit () {
> rm -rf .hg && hg init
> }
$ hg init
Test what said in drawdag.py docstring
$ hg debugdrawdag <<'EOS'
> c d
> |/
> b
> |
> a
> EOS
$ hg log -G -T '{rev} {desc} ({tags})'
o 3 d (d tip)
|
| o 2 c (c)
|/
o 1 b (b)
|
o 0 a (a)
$ hg debugdrawdag <<'EOS'
> foo bar bar foo
> | / | |
> ancestor(c,d) a baz
> EOS
$ hg log -G -T '{desc}'
o foo
|\
+---o bar
| | |
| o | baz
| /
+---o d
| |
+---o c
| |
o | b
|/
o a
$ reinit
$ hg debugdrawdag <<'EOS'
> o foo
> |\
> +---o bar
> | | |
> | o | baz
> | /
> +---o d
> | |
> +---o c
> | |
> o | b
> |/
> o a
> EOS
$ hg log -G -T '{desc}'
o foo
|\
| | o d
| |/
| | o c
| |/
| | o bar
| |/|
| o | b
| |/
o / baz
/
o a
$ reinit
$ hg debugdrawdag <<'EOS'
> o foo
> |\
> | | o d
> | |/
> | | o c
> | |/
> | | o bar
> | |/|
> | o | b
> | |/
> o / baz
> /
> o a
> EOS
$ hg log -G -T '{desc}'
o foo
|\
| | o d
| |/
| | o c
| |/
| | o bar
| |/|
| o | b
| |/
o / baz
/
o a
$ hg manifest -r a
a
$ hg manifest -r b
a
b
$ hg manifest -r bar
a
b
$ hg manifest -r foo
a
b
baz
Edges existed in repo are no-ops
$ reinit
$ hg debugdrawdag <<'EOS'
> B C C
> | | |
> A A B
> EOS
$ hg log -G -T '{desc}'
o C
|\
| o B
|/
o A
$ hg debugdrawdag <<'EOS'
> C D C
> | | |
> B B A
> EOS
$ hg log -G -T '{desc}'
o D
|
| o C
|/|
o | B
|/
o A
Node with more than 2 parents are disallowed
$ hg debugdrawdag <<'EOS'
> A
> /|\
> D B C
> EOS
abort: A: too many parents: C D B
[255]
Cycles are disallowed
$ hg debugdrawdag <<'EOS'
> A
> |
> A
> EOS
abort: the graph has cycles
[255]
$ hg debugdrawdag <<'EOS'
> A
> |
> B
> |
> A
> EOS
abort: the graph has cycles
[255]
Create obsmarkers via comments
$ reinit
$ hg debugdrawdag <<'EOS'
> G
> |
> I D C F # split: B -> E, F, G
> \ \| | # replace: C -> D -> H
> H B E # prune: F, I
> \|/
> A
> EOS
1 new orphan changesets
$ hg log -r 'sort(all(), topo)' -G --hidden -T '{desc} {node}'
* G 711f53bbef0bebd12eb6f0511d5e2e998b984846
|
x F 64a8289d249234b9886244d379f15e6b650b28e3
|
o E 7fb047a69f220c21711122dfd94305a9efb60cba
|
| x D be0ef73c17ade3fc89dc41701eb9fc3a91b58282
| |
| | x C 26805aba1e600a82e93661149f2313866a221a7b
| |/
| x B 112478962961147124edd43549aedd1a335e44bf
|/
| x I 58e6b987bf7045fcd9c54f496396ca1d1fc81047
| |
| o H 575c4b5ec114d64b681d33f8792853568bfb2b2c
|/
o A 426bada5c67598ca65036d57d9e4b64b0c1ce7a0
$ hg debugobsolete
112478962961147124edd43549aedd1a335e44bf 7fb047a69f220c21711122dfd94305a9efb60cba 64a8289d249234b9886244d379f15e6b650b28e3 711f53bbef0bebd12eb6f0511d5e2e998b984846 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'split', 'user': 'test'}
26805aba1e600a82e93661149f2313866a221a7b be0ef73c17ade3fc89dc41701eb9fc3a91b58282 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '9', 'operation': 'replace', 'user': 'test'}
be0ef73c17ade3fc89dc41701eb9fc3a91b58282 575c4b5ec114d64b681d33f8792853568bfb2b2c 0 (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '13', 'operation': 'replace', 'user': 'test'}
64a8289d249234b9886244d379f15e6b650b28e3 0 {7fb047a69f220c21711122dfd94305a9efb60cba} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'}
58e6b987bf7045fcd9c54f496396ca1d1fc81047 0 {575c4b5ec114d64b681d33f8792853568bfb2b2c} (Thu Jan 01 00:00:00 1970 +0000) {'ef1': '0', 'operation': 'prune', 'user': 'test'}
Change file contents via comments
$ reinit
$ hg debugdrawdag <<'EOS'
> C # A/dir1/a = 1\n2
> |\ # B/dir2/b = 34
> A B # C/dir1/c = 5
> # C/dir2/c = 6
> # C/A = a
> # C/B = b
> EOS
$ hg log -G -T '{desc} {files}'
o C A B dir1/c dir2/c
|\
| o B B dir2/b
|
o A A dir1/a
$ for f in `hg files -r C`; do
> echo FILE "$f"
> hg cat -r C "$f"
> echo
> done
FILE A
a
FILE B
b
FILE dir1/a
1
2
FILE dir1/c
5
FILE dir2/b
34
FILE dir2/c
6