Mercurial > hg > mercurial-crew-with-dirclash
comparison mercurial/localrepo.py @ 1280:50553b99a5c9
pull/unbundle: raise an exception on premature EOF
author | mpm@selenic.com |
---|---|
date | Tue, 20 Sep 2005 10:45:26 -0700 |
parents | 4603eef60237 |
children | b650bfdfc7ee |
comparison
equal
deleted
inserted
replaced
1279:8ab1c07d4e0b | 1280:50553b99a5c9 |
---|---|
954 def getchunk(): | 954 def getchunk(): |
955 d = source.read(4) | 955 d = source.read(4) |
956 if not d: return "" | 956 if not d: return "" |
957 l = struct.unpack(">l", d)[0] | 957 l = struct.unpack(">l", d)[0] |
958 if l <= 4: return "" | 958 if l <= 4: return "" |
959 return source.read(l - 4) | 959 d = source.read(l - 4) |
960 if len(d) < l - 4: | |
961 raise repo.RepoError("premature EOF reading chunk" + | |
962 " (got %d bytes, expected %d)" | |
963 % (len(d), l - 4)) | |
964 return d | |
960 | 965 |
961 def getgroup(): | 966 def getgroup(): |
962 while 1: | 967 while 1: |
963 c = getchunk() | 968 c = getchunk() |
964 if not c: break | 969 if not c: break |