mercurial/changegroup.py
changeset 35754 fb0be099063f
parent 35012 d80380ba8e7d
child 36464 3f0af89e008d
child 36743 d031609b3cb7
--- a/mercurial/changegroup.py	Fri Jan 19 19:13:11 2018 -0500
+++ b/mercurial/changegroup.py	Fri Jan 19 20:51:35 2018 +0100
@@ -32,14 +32,7 @@
 _CHANGEGROUPV2_DELTA_HEADER = "20s20s20s20s20s"
 _CHANGEGROUPV3_DELTA_HEADER = ">20s20s20s20s20sH"
 
-def readexactly(stream, n):
-    '''read n bytes from stream.read and abort if less was available'''
-    s = stream.read(n)
-    if len(s) < n:
-        raise error.Abort(_("stream ended unexpectedly"
-                           " (got %d bytes, expected %d)")
-                          % (len(s), n))
-    return s
+readexactly = util.readexactly
 
 def getchunk(stream):
     """return the next chunk from stream as a string"""