##// END OF EJS Templates
manifest: refer to bytestrings as bytes, not str...
Augie Fackler -
r31531:326bca54 default
parent child Browse files
Show More
@@ -284,17 +284,17 b' class _lazymanifest(object):'
284 self.data = self.data[:cur] + '\x00' + self.data[cur + 1:]
284 self.data = self.data[:cur] + '\x00' + self.data[cur + 1:]
285
285
286 def __setitem__(self, key, value):
286 def __setitem__(self, key, value):
287 if not isinstance(key, str):
287 if not isinstance(key, bytes):
288 raise TypeError("setitem: manifest keys must be a string.")
288 raise TypeError("setitem: manifest keys must be a byte string.")
289 if not isinstance(value, tuple) or len(value) != 2:
289 if not isinstance(value, tuple) or len(value) != 2:
290 raise TypeError("Manifest values must be a tuple of (node, flags).")
290 raise TypeError("Manifest values must be a tuple of (node, flags).")
291 hashval = value[0]
291 hashval = value[0]
292 if not isinstance(hashval, str) or not 20 <= len(hashval) <= 22:
292 if not isinstance(hashval, bytes) or not 20 <= len(hashval) <= 22:
293 raise TypeError("node must be a 20-byte string")
293 raise TypeError("node must be a 20-byte byte string")
294 flags = value[1]
294 flags = value[1]
295 if len(hashval) == 22:
295 if len(hashval) == 22:
296 hashval = hashval[:-1]
296 hashval = hashval[:-1]
297 if not isinstance(flags, str) or len(flags) > 1:
297 if not isinstance(flags, bytes) or len(flags) > 1:
298 raise TypeError("flags must a 0 or 1 byte string, got %r", flags)
298 raise TypeError("flags must a 0 or 1 byte string, got %r", flags)
299 needle, found = self.bsearch2(key)
299 needle, found = self.bsearch2(key)
300 if found:
300 if found:
General Comments 0
You need to be logged in to leave comments. Login now