changeset 27415:f4ca33e33781

commandserver: implement name() to clarify channel is not a plain file Because unknown attributes are delegated to the underlying file object, commandserver channels said they were '<stdout>' or '<stdin>' even though they weren't. This patch makes them say '<X-channel>'.
author Yuya Nishihara <yuya@tcha.org>
date Sun, 13 Dec 2015 19:32:01 +0900
parents 6602a7b9deec
children 9d04b4da6773
files mercurial/commandserver.py
diffstat 1 files changed, 8 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/commandserver.py	Tue Dec 15 13:27:09 2015 -0800
+++ b/mercurial/commandserver.py	Sun Dec 13 19:32:01 2015 +0900
@@ -43,6 +43,10 @@
         self.out = out
         self.channel = channel
 
+    @property
+    def name(self):
+        return '<%c-channel>' % self.channel
+
     def write(self, data):
         if not data:
             return
@@ -75,6 +79,10 @@
         self.out = out
         self.channel = channel
 
+    @property
+    def name(self):
+        return '<%c-channel>' % self.channel
+
     def read(self, size=-1):
         if size < 0:
             # if we need to consume all the clients input, ask for 4k chunks