comparison mercurial/commandserver.py @ 27915:5f2a308bac94 stable

commandserver: drop tell() and seek() from channels (issue5049) These operations are obviously invalid for file-like channels because they will read or write protocol headers. This patch works around the issue that "hg archive" generates a corrupted zip file on Windows commandserver because of unusable tell() implementation. But the problem still occurs without using a commandserver. $ hg archive -R not-small-repo -t zip - | cat > invalid.zip So, this patch cannot fix the issue5049 completely.
author Yuya Nishihara <yuya@tcha.org>
date Wed, 20 Jan 2016 00:08:00 +0900
parents 5d6f984c8375
children 14033c5dd261
comparison
equal deleted inserted replaced
27914:505a10b504ed 27915:5f2a308bac94
53 self.out.write(struct.pack('>cI', self.channel, len(data))) 53 self.out.write(struct.pack('>cI', self.channel, len(data)))
54 self.out.write(data) 54 self.out.write(data)
55 self.out.flush() 55 self.out.flush()
56 56
57 def __getattr__(self, attr): 57 def __getattr__(self, attr):
58 if attr in ('isatty', 'fileno'): 58 if attr in ('isatty', 'fileno', 'tell', 'seek'):
59 raise AttributeError(attr) 59 raise AttributeError(attr)
60 return getattr(self.out, attr) 60 return getattr(self.out, attr)
61 61
62 class channeledinput(object): 62 class channeledinput(object):
63 """ 63 """
137 if not l: 137 if not l:
138 raise StopIteration 138 raise StopIteration
139 return l 139 return l
140 140
141 def __getattr__(self, attr): 141 def __getattr__(self, attr):
142 if attr in ('isatty', 'fileno'): 142 if attr in ('isatty', 'fileno', 'tell', 'seek'):
143 raise AttributeError(attr) 143 raise AttributeError(attr)
144 return getattr(self.in_, attr) 144 return getattr(self.in_, attr)
145 145
146 class server(object): 146 class server(object):
147 """ 147 """