diff options
author | Daniel Silverstone <daniel.silverstone@codethink.co.uk> | 2012-09-27 14:30:31 +0100 |
---|---|---|
committer | Daniel Silverstone <daniel.silverstone@codethink.co.uk> | 2012-09-27 14:30:31 +0100 |
commit | 4b0aa73b8c69bd5b7521337809f7bc4714209a5a (patch) | |
tree | 75f4c36771caf222280249cd1ed611d5ade8bd48 /mercurial/byterange.py | |
parent | 59a96880b5d035db83067acda8345497c75d7716 (diff) | |
parent | 921ced43c48c1d170452a7b251b94cc96ec8dd44 (diff) | |
download | mercurial-tarball-baserock/morph.tar.gz |
Merge remote-tracking branch 'origin/master' into baserock/morphbaserock/morph
This changes us to 1.9.3 which might stand a better chance of being
usable by Lorry.
We also undo the setup.py change because python now supports bz2
Diffstat (limited to 'mercurial/byterange.py')
-rw-r--r-- | mercurial/byterange.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/mercurial/byterange.py b/mercurial/byterange.py index f4f5f53..cc8f893 100644 --- a/mercurial/byterange.py +++ b/mercurial/byterange.py @@ -9,8 +9,10 @@ # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public -# License along with this library; if not, see -# <http://www.gnu.org/licenses/>. +# License along with this library; if not, write to the +# Free Software Foundation, Inc., +# 59 Temple Place, Suite 330, +# Boston, MA 02111-1307 USA # This file is part of urlgrabber, a high-level cross-protocol url-grabber # Copyright 2002-2004 Michael D. Stenner, Ryan Tomayko @@ -101,7 +103,9 @@ class RangeableFileObject(object): """This effectively allows us to wrap at the instance level. Any attribute not found in _this_ object will be searched for in self.fo. This includes methods.""" - return getattr(self.fo, name) + if hasattr(self.fo, name): + return getattr(self.fo, name) + raise AttributeError(name) def tell(self): """Return the position within the range. @@ -166,8 +170,10 @@ class RangeableFileObject(object): offset is relative to the current position (self.realpos). """ assert offset >= 0 - seek = getattr(self.fo, 'seek', self._poor_mans_seek) - seek(self.realpos + offset) + if not hasattr(self.fo, 'seek'): + self._poor_mans_seek(offset) + else: + self.fo.seek(self.realpos + offset) self.realpos += offset def _poor_mans_seek(self, offset): |