Mercurial > hg
comparison tests/test-ssh-proto.t @ 36531:097ad1079192
debugcommands: support for sending "batch" requests
Let's teach `hg debugwireproto` to send "batch" requests.
The easiest way to implement this was as a pair of instructions to
begin and end a batched operation. Otherwise, we would have to reinvent
the parsing wheel or factor out the parsing code.
To prove it works, we add a batched request to test-ssh-proto.t.
Differential Revision: https://phab.mercurial-scm.org/D2408
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Fri, 23 Feb 2018 12:50:59 -0800 |
parents | bde0bd50f368 |
children | 1138e5c0fbc9 |
comparison
equal
deleted
inserted
replaced
36530:bde0bd50f368 | 36531:097ad1079192 |
---|---|
1828 i> flush() -> None | 1828 i> flush() -> None |
1829 o> bufferedreadline() -> 3: | 1829 o> bufferedreadline() -> 3: |
1830 o> 15\n | 1830 o> 15\n |
1831 o> bufferedread(15) -> 15: publishing True | 1831 o> bufferedread(15) -> 15: publishing True |
1832 response: publishing True | 1832 response: publishing True |
1833 | |
1834 $ cd .. | |
1835 | |
1836 Test batching of requests | |
1837 | |
1838 $ hg init batching | |
1839 $ cd batching | |
1840 $ echo 0 > foo | |
1841 $ hg add foo | |
1842 $ hg -q commit -m initial | |
1843 $ hg phase --public | |
1844 $ echo 1 > foo | |
1845 $ hg commit -m 'commit 1' | |
1846 $ hg -q up 0 | |
1847 $ echo 2 > foo | |
1848 $ hg commit -m 'commit 2' | |
1849 created new head | |
1850 $ hg book -r 1 bookA | |
1851 $ hg book -r 2 bookB | |
1852 | |
1853 $ debugwireproto << EOF | |
1854 > batchbegin | |
1855 > command heads | |
1856 > command listkeys | |
1857 > namespace bookmarks | |
1858 > command listkeys | |
1859 > namespace phases | |
1860 > batchsubmit | |
1861 > EOF | |
1862 testing ssh1 | |
1863 creating ssh peer from handshake results | |
1864 i> write(104) -> None: | |
1865 i> hello\n | |
1866 i> between\n | |
1867 i> pairs 81\n | |
1868 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1869 i> flush() -> None | |
1870 o> readline() -> 4: | |
1871 o> 384\n | |
1872 o> readline() -> 384: | |
1873 o> capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN\n | |
1874 o> readline() -> 2: | |
1875 o> 1\n | |
1876 o> readline() -> 1: | |
1877 o> \n | |
1878 sending batch with 3 sub-commands | |
1879 i> write(6) -> None: | |
1880 i> batch\n | |
1881 i> write(4) -> None: | |
1882 i> * 0\n | |
1883 i> write(8) -> None: | |
1884 i> cmds 61\n | |
1885 i> write(61) -> None: heads ;listkeys namespace=bookmarks;listkeys namespace=phases | |
1886 i> flush() -> None | |
1887 o> bufferedreadline() -> 4: | |
1888 o> 278\n | |
1889 o> bufferedread(278) -> 278: | |
1890 o> bfebe6bd38eebc6f8202e419c1171268987ea6a6 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n | |
1891 o> ;bookA 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n | |
1892 o> bookB bfebe6bd38eebc6f8202e419c1171268987ea6a6;4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab 1\n | |
1893 o> bfebe6bd38eebc6f8202e419c1171268987ea6a6 1\n | |
1894 o> publishing True | |
1895 response #0: bfebe6bd38eebc6f8202e419c1171268987ea6a6 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n | |
1896 response #1: bookA 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\nbookB bfebe6bd38eebc6f8202e419c1171268987ea6a6 | |
1897 response #2: 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab 1\nbfebe6bd38eebc6f8202e419c1171268987ea6a6 1\npublishing True | |
1898 | |
1899 testing ssh2 | |
1900 creating ssh peer from handshake results | |
1901 i> write(171) -> None: | |
1902 i> upgrade * proto=exp-ssh-v2-0001\n (glob) | |
1903 i> hello\n | |
1904 i> between\n | |
1905 i> pairs 81\n | |
1906 i> 0000000000000000000000000000000000000000-0000000000000000000000000000000000000000 | |
1907 i> flush() -> None | |
1908 o> readline() -> 62: | |
1909 o> upgraded * exp-ssh-v2-0001\n (glob) | |
1910 o> readline() -> 4: | |
1911 o> 383\n | |
1912 o> read(383) -> 383: capabilities: lookup changegroupsubset branchmap pushkey known getbundle unbundlehash batch streamreqs=generaldelta,revlogv1 $USUAL_BUNDLE2_CAPS_SERVER$ unbundle=HG10GZ,HG10BZ,HG10UN | |
1913 o> read(1) -> 1: | |
1914 o> \n | |
1915 sending batch with 3 sub-commands | |
1916 i> write(6) -> None: | |
1917 i> batch\n | |
1918 i> write(4) -> None: | |
1919 i> * 0\n | |
1920 i> write(8) -> None: | |
1921 i> cmds 61\n | |
1922 i> write(61) -> None: heads ;listkeys namespace=bookmarks;listkeys namespace=phases | |
1923 i> flush() -> None | |
1924 o> bufferedreadline() -> 4: | |
1925 o> 278\n | |
1926 o> bufferedread(278) -> 278: | |
1927 o> bfebe6bd38eebc6f8202e419c1171268987ea6a6 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n | |
1928 o> ;bookA 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n | |
1929 o> bookB bfebe6bd38eebc6f8202e419c1171268987ea6a6;4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab 1\n | |
1930 o> bfebe6bd38eebc6f8202e419c1171268987ea6a6 1\n | |
1931 o> publishing True | |
1932 response #0: bfebe6bd38eebc6f8202e419c1171268987ea6a6 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\n | |
1933 response #1: bookA 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab\nbookB bfebe6bd38eebc6f8202e419c1171268987ea6a6 | |
1934 response #2: 4ee3fcef1c800fa2bf23e20af7c83ff111d9c7ab 1\nbfebe6bd38eebc6f8202e419c1171268987ea6a6 1\npublishing True |