Patchwork D3298: debugcommands: use command executor for invoking commands

login
register
mail settings
Submitter phabricator
Date April 13, 2018, 9:37 p.m.
Message ID <680ab356c40d283606ec0556782bd8ea@localhost.localdomain>
Download mbox | patch
Permalink /patch/30899/
State Not Applicable
Headers show

Comments

phabricator - April 13, 2018, 9:37 p.m.
indygreg updated this revision to Diff 8154.

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D3298?vs=8091&id=8154

REVISION DETAIL
  https://phab.mercurial-scm.org/D3298

AFFECTED FILES
  mercurial/debugcommands.py
  tests/test-http-protocol.t
  tests/test-ssh-proto.t

CHANGE DETAILS




To: indygreg, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/tests/test-ssh-proto.t b/tests/test-ssh-proto.t
--- a/tests/test-ssh-proto.t
+++ b/tests/test-ssh-proto.t
@@ -1367,7 +1367,7 @@ 
   o>     bookmarks\t\n
   o>     namespaces\t\n
   o>     phases\t
-  response: b'bookmarks\t\nnamespaces\t\nphases\t'
+  response: {b'bookmarks': b'', b'namespaces': b'', b'phases': b''}
   
   testing ssh2
   creating ssh peer from handshake results
@@ -1398,7 +1398,7 @@ 
   o>     bookmarks\t\n
   o>     namespaces\t\n
   o>     phases\t
-  response: b'bookmarks\t\nnamespaces\t\nphases\t'
+  response: {b'bookmarks': b'', b'namespaces': b'', b'phases': b''}
 
   $ cd ..
 
@@ -1443,7 +1443,7 @@ 
   i> flush() -> None
   o> bufferedreadline() -> 2:
   o>     0\n
-  response: b''
+  response: {}
   
   testing ssh2
   creating ssh peer from handshake results
@@ -1470,7 +1470,7 @@ 
   i> flush() -> None
   o> bufferedreadline() -> 2:
   o>     0\n
-  response: b''
+  response: {}
 
 With a single bookmark set
 
@@ -1505,7 +1505,7 @@ 
   o> bufferedreadline() -> 3:
   o>     46\n
   o> bufferedread(46) -> 46: bookA\t68986213bd4485ea51533535e3fc9e78007a711f
-  response: b'bookA\t68986213bd4485ea51533535e3fc9e78007a711f'
+  response: {b'bookA': b'68986213bd4485ea51533535e3fc9e78007a711f'}
   
   testing ssh2
   creating ssh peer from handshake results
@@ -1533,7 +1533,7 @@ 
   o> bufferedreadline() -> 3:
   o>     46\n
   o> bufferedread(46) -> 46: bookA\t68986213bd4485ea51533535e3fc9e78007a711f
-  response: b'bookA\t68986213bd4485ea51533535e3fc9e78007a711f'
+  response: {b'bookA': b'68986213bd4485ea51533535e3fc9e78007a711f'}
 
 With multiple bookmarks set
 
@@ -1570,7 +1570,7 @@ 
   o> bufferedread(93) -> 93:
   o>     bookA\t68986213bd4485ea51533535e3fc9e78007a711f\n
   o>     bookB\t1880f3755e2e52e3199e0ee5638128b08642f34d
-  response: b'bookA\t68986213bd4485ea51533535e3fc9e78007a711f\nbookB\t1880f3755e2e52e3199e0ee5638128b08642f34d'
+  response: {b'bookA': b'68986213bd4485ea51533535e3fc9e78007a711f', b'bookB': b'1880f3755e2e52e3199e0ee5638128b08642f34d'}
   
   testing ssh2
   creating ssh peer from handshake results
@@ -1600,7 +1600,7 @@ 
   o> bufferedread(93) -> 93:
   o>     bookA\t68986213bd4485ea51533535e3fc9e78007a711f\n
   o>     bookB\t1880f3755e2e52e3199e0ee5638128b08642f34d
-  response: b'bookA\t68986213bd4485ea51533535e3fc9e78007a711f\nbookB\t1880f3755e2e52e3199e0ee5638128b08642f34d'
+  response: {b'bookA': b'68986213bd4485ea51533535e3fc9e78007a711f', b'bookB': b'1880f3755e2e52e3199e0ee5638128b08642f34d'}
 
 Test pushkey for bookmarks
 
@@ -1646,7 +1646,7 @@ 
   o>     2\n
   o> bufferedread(2) -> 2:
   o>     1\n
-  response: b'1\n'
+  response: True
   
   testing ssh2
   creating ssh peer from handshake results
@@ -1683,7 +1683,7 @@ 
   o>     2\n
   o> bufferedread(2) -> 2:
   o>     1\n
-  response: b'1\n'
+  response: True
 
   $ hg bookmarks
      bookA                     0:68986213bd44
@@ -1729,7 +1729,7 @@ 
   o> bufferedreadline() -> 3:
   o>     15\n
   o> bufferedread(15) -> 15: publishing\tTrue
-  response: b'publishing\tTrue'
+  response: {b'publishing': b'True'}
   
   testing ssh2
   creating ssh peer from handshake results
@@ -1757,7 +1757,7 @@ 
   o> bufferedreadline() -> 3:
   o>     15\n
   o> bufferedread(15) -> 15: publishing\tTrue
-  response: b'publishing\tTrue'
+  response: {b'publishing': b'True'}
 
 Create some commits
 
@@ -1811,7 +1811,7 @@ 
   o>     20b8a89289d80036e6c4e87c2083e3bea1586637\t1\n
   o>     c4750011d906c18ea2f0527419cbc1a544435150\t1\n
   o>     publishing\tTrue
-  response: b'20b8a89289d80036e6c4e87c2083e3bea1586637\t1\nc4750011d906c18ea2f0527419cbc1a544435150\t1\npublishing\tTrue'
+  response: {b'20b8a89289d80036e6c4e87c2083e3bea1586637': b'1', b'c4750011d906c18ea2f0527419cbc1a544435150': b'1', b'publishing': b'True'}
   
   testing ssh2
   creating ssh peer from handshake results
@@ -1842,7 +1842,7 @@ 
   o>     20b8a89289d80036e6c4e87c2083e3bea1586637\t1\n
   o>     c4750011d906c18ea2f0527419cbc1a544435150\t1\n
   o>     publishing\tTrue
-  response: b'20b8a89289d80036e6c4e87c2083e3bea1586637\t1\nc4750011d906c18ea2f0527419cbc1a544435150\t1\npublishing\tTrue'
+  response: {b'20b8a89289d80036e6c4e87c2083e3bea1586637': b'1', b'c4750011d906c18ea2f0527419cbc1a544435150': b'1', b'publishing': b'True'}
 
 Single draft head
 
@@ -1879,7 +1879,7 @@ 
   o> bufferedread(58) -> 58:
   o>     c4750011d906c18ea2f0527419cbc1a544435150\t1\n
   o>     publishing\tTrue
-  response: b'c4750011d906c18ea2f0527419cbc1a544435150\t1\npublishing\tTrue'
+  response: {b'c4750011d906c18ea2f0527419cbc1a544435150': b'1', b'publishing': b'True'}
   
   testing ssh2
   creating ssh peer from handshake results
@@ -1909,7 +1909,7 @@ 
   o> bufferedread(58) -> 58:
   o>     c4750011d906c18ea2f0527419cbc1a544435150\t1\n
   o>     publishing\tTrue
-  response: b'c4750011d906c18ea2f0527419cbc1a544435150\t1\npublishing\tTrue'
+  response: {b'c4750011d906c18ea2f0527419cbc1a544435150': b'1', b'publishing': b'True'}
 
 All public heads
 
@@ -1944,7 +1944,7 @@ 
   o> bufferedreadline() -> 3:
   o>     15\n
   o> bufferedread(15) -> 15: publishing\tTrue
-  response: b'publishing\tTrue'
+  response: {b'publishing': b'True'}
   
   testing ssh2
   creating ssh peer from handshake results
@@ -1972,7 +1972,7 @@ 
   o> bufferedreadline() -> 3:
   o>     15\n
   o> bufferedread(15) -> 15: publishing\tTrue
-  response: b'publishing\tTrue'
+  response: {b'publishing': b'True'}
 
 Setting public phase via pushkey
 
@@ -2021,7 +2021,7 @@ 
   o>     2\n
   o> bufferedread(2) -> 2:
   o>     1\n
-  response: b'1\n'
+  response: True
   
   testing ssh2
   creating ssh peer from handshake results
@@ -2059,7 +2059,7 @@ 
   o>     2\n
   o> bufferedread(2) -> 2:
   o>     1\n
-  response: b'1\n'
+  response: True
 
   $ hg phase .
   4: public
diff --git a/tests/test-http-protocol.t b/tests/test-http-protocol.t
--- a/tests/test-http-protocol.t
+++ b/tests/test-http-protocol.t
@@ -211,7 +211,7 @@ 
   s>     bookmarks\t\n
   s>     namespaces\t\n
   s>     phases\t
-  response: b'bookmarks\t\nnamespaces\t\nphases\t'
+  response: {b'bookmarks': b'', b'namespaces': b'', b'phases': b''}
 
 Same thing, but with "httprequest" command
 
@@ -277,7 +277,7 @@ 
   s>     Content-Length: 41\r\n
   s>     \r\n
   s>     0000000000000000000000000000000000000000\n
-  response: b'0000000000000000000000000000000000000000\n'
+  response: [b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00']
 
   $ killdaemons.py
   $ enablehttpv2 empty
diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -3001,7 +3001,9 @@ 
                     ui.status(_('remote output: %s\n') %
                               stringutil.escapestr(output))
             else:
-                res = peer._call(command, **pycompat.strkwargs(args))
+                with peer.commandexecutor() as e:
+                    res = e.callcommand(command, args).result()
+
                 ui.status(_('response: %s\n') % stringutil.pprint(res))
 
         elif action == 'batchbegin':