Patchwork [2,of,5,V2] commandserver: use _readlist

login
register
mail settings
Submitter Jun Wu
Date Feb. 16, 2016, 7:50 p.m.
Message ID <142c74f520634a006d1a.1455652223@x1c>
Download mbox | patch
Permalink /patch/13230/
State Accepted
Delegated to: Yuya Nishihara
Headers show

Comments

Jun Wu - Feb. 16, 2016, 7:50 p.m.
# HG changeset patch
# User Jun Wu <quark@fb.com>
# Date 1455546041 0
#      Mon Feb 15 14:20:41 2016 +0000
# Node ID 142c74f520634a006d1aa9ae5a69e37c63e41256
# Parent  4fee628c32ea96ebc9c51eb3a1c22ef94feb8645
commandserver: use _readlist

Use _readlist introduced in previous commit to make the code shorter.

Patch

diff --git a/mercurial/commandserver.py b/mercurial/commandserver.py
--- a/mercurial/commandserver.py
+++ b/mercurial/commandserver.py
@@ -214,11 +214,7 @@ 
         and writes the return code to the result channel """
         from . import dispatch  # avoid cycle
 
-        length = struct.unpack('>I', self._read(4))[0]
-        if not length:
-            args = []
-        else:
-            args = self._read(length).split('\0')
+        args = self._readlist()
 
         # copy the uis so changes (e.g. --config or --verbose) don't
         # persist between requests