Patchwork [1,of,4] bundle2.unpackermixin: default value for seek() whence parameter

login
register
mail settings
Submitter Eric Sumner
Date Feb. 6, 2015, 7:47 p.m.
Message ID <1ad4be7f38934fb84161.1423252051@waste.org>
Download mbox | patch
Permalink /patch/7716/
State Accepted
Commit de32e9881698bfe6536cee497bdff81dc928fa85
Headers show

Comments

Eric Sumner - Feb. 6, 2015, 7:47 p.m.
# HG changeset patch
# User Eric Sumner <ericsumner@fb.com>
# Date 1423180377 28800
#      Thu Feb 05 15:52:57 2015 -0800
# Node ID 1ad4be7f38934fb84161588d7d4b106c20beec49
# Parent  a9b61dbdb827165a9fd9d44dd42b892dbd9fa07c
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.

Patch

diff --git a/mercurial/bundle2.py b/mercurial/bundle2.py
--- a/mercurial/bundle2.py
+++ b/mercurial/bundle2.py
@@ -497,7 +497,7 @@ 
         """read exactly <size> bytes from the stream"""
         return changegroup.readexactly(self._fp, size)
 
-    def seek(self, offset, whence):
+    def seek(self, offset, whence=0):
         """move the underlying file pointer"""
         if self._seekable:
             return self._fp.seek(offset, whence)