Mercurial > hg
comparison mercurial/bundle2.py @ 24070:de32e9881698
bundle2.unpackermixin: default value for seek() whence parameter
The contract for seek() includes seeking to an offset from the beginning of the
file when whence is omitted; put this implementation in compliance.
author | Eric Sumner <ericsumner@fb.com> |
---|---|
date | Thu, 05 Feb 2015 15:52:57 -0800 |
parents | 13d88b7eb3a0 |
children | 184a2f6f40da |
comparison
equal
deleted
inserted
replaced
24069:c6666395fdd2 | 24070:de32e9881698 |
---|---|
495 | 495 |
496 def _readexact(self, size): | 496 def _readexact(self, size): |
497 """read exactly <size> bytes from the stream""" | 497 """read exactly <size> bytes from the stream""" |
498 return changegroup.readexactly(self._fp, size) | 498 return changegroup.readexactly(self._fp, size) |
499 | 499 |
500 def seek(self, offset, whence): | 500 def seek(self, offset, whence=0): |
501 """move the underlying file pointer""" | 501 """move the underlying file pointer""" |
502 if self._seekable: | 502 if self._seekable: |
503 return self._fp.seek(offset, whence) | 503 return self._fp.seek(offset, whence) |
504 else: | 504 else: |
505 raise NotImplementedError(_('File pointer is not seekable')) | 505 raise NotImplementedError(_('File pointer is not seekable')) |