##// END OF EJS Templates
util: move 'readexactly' in the util module...
Boris Feld -
r35772:fb0be099 default
parent child Browse files
Show More
@@ -32,14 +32,7 b' from . import ('
32 _CHANGEGROUPV2_DELTA_HEADER = "20s20s20s20s20s"
32 _CHANGEGROUPV2_DELTA_HEADER = "20s20s20s20s20s"
33 _CHANGEGROUPV3_DELTA_HEADER = ">20s20s20s20s20sH"
33 _CHANGEGROUPV3_DELTA_HEADER = ">20s20s20s20s20sH"
34
34
35 def readexactly(stream, n):
35 readexactly = util.readexactly
36 '''read n bytes from stream.read and abort if less was available'''
37 s = stream.read(n)
38 if len(s) < n:
39 raise error.Abort(_("stream ended unexpectedly"
40 " (got %d bytes, expected %d)")
41 % (len(s), n))
42 return s
43
36
44 def getchunk(stream):
37 def getchunk(stream):
45 """return the next chunk from stream as a string"""
38 """return the next chunk from stream as a string"""
@@ -3865,3 +3865,12 b' def safename(f, tag, ctx, others=None):'
3865 fn = '%s~%s~%s' % (f, tag, n)
3865 fn = '%s~%s~%s' % (f, tag, n)
3866 if fn not in ctx and fn not in others:
3866 if fn not in ctx and fn not in others:
3867 return fn
3867 return fn
3868
3869 def readexactly(stream, n):
3870 '''read n bytes from stream.read and abort if less was available'''
3871 s = stream.read(n)
3872 if len(s) < n:
3873 raise error.Abort(_("stream ended unexpectedly"
3874 " (got %d bytes, expected %d)")
3875 % (len(s), n))
3876 return s
General Comments 0
You need to be logged in to leave comments. Login now