Patchwork D2720: debugcommands: introduce actions to perform deterministic reads

login
register
mail settings
Submitter phabricator
Date March 20, 2018, 1:40 a.m.
Message ID <cab1f4c54ad7155176b3e099ba7343aa@localhost.localdomain>
Download mbox | patch
Permalink /patch/29666/
State Not Applicable
Headers show

Comments

phabricator - March 20, 2018, 1:40 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG143219fc2620: debugcommands: introduce actions to perform deterministic reads (authored by indygreg, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D2720?vs=6976&id=7153

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

AFFECTED FILES
  mercurial/debugcommands.py

CHANGE DETAILS




To: indygreg, #hg-reviewers, durin42
Cc: yuja, mharbison72, mercurial-devel

Patch

diff --git a/mercurial/debugcommands.py b/mercurial/debugcommands.py
--- a/mercurial/debugcommands.py
+++ b/mercurial/debugcommands.py
@@ -2715,6 +2715,21 @@ 
 
     Read a line of output from the server. If there are multiple output
     pipes, reads only the main pipe.
+
+    ereadline
+    ---------
+
+    Like ``readline``, but read from the stderr pipe, if available.
+
+    read <X>
+    --------
+
+    ``read()`` N bytes from the server's main output pipe.
+
+    eread <X>
+    ---------
+
+    ``read()`` N bytes from the server's stderr pipe, if available.
     """
     opts = pycompat.byteskwargs(opts)
 
@@ -2855,6 +2870,14 @@ 
             stderr.read()
         elif action == 'readline':
             stdout.readline()
+        elif action == 'ereadline':
+            stderr.readline()
+        elif action.startswith('read '):
+            count = int(action.split(' ', 1)[1])
+            stdout.read(count)
+        elif action.startswith('eread '):
+            count = int(action.split(' ', 1)[1])
+            stderr.read(count)
         else:
             raise error.Abort(_('unknown action: %s') % action)