Mercurial > hg
diff mercurial/branchmap.py @ 28557:4b83507bfc91
cache: safer handling of failing seek when writing revision branch cache
If the seek for some reason fails (perhaps because the file is too short to
search to the requested position), make sure we seek to the start and rewrite
everything.
It is unknown if this fixes a real problem that ever happened.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Sun, 13 Mar 2016 02:06:22 +0100 |
parents | 0706d60d070f |
children | bcd106d456c4 |
line wrap: on
line diff
--- a/mercurial/branchmap.py Sun Mar 13 02:06:21 2016 +0100 +++ b/mercurial/branchmap.py Sun Mar 13 02:06:22 2016 +0100 @@ -482,6 +482,9 @@ if f.tell() != start: repo.ui.debug("truncating %s to %s\n" % (_rbcrevs, start)) f.seek(start) + if f.tell() != start: + start = 0 + f.seek(start) f.truncate() end = revs * _rbcrecsize f.write(self._rbcrevs[start:end])