[PATCH] util: add length argument to util.buffer()
Yuya Nishihara
yuya at tcha.org
Sun Jan 15 11:45:42 UTC 2017
On Sun, 15 Jan 2017 17:04:24 +0530, Pulkit Goyal wrote:
> # HG changeset patch
> # User Pulkit Goyal <7895pulkit at gmail.com>
> # Date 1484404515 -19800
> # Sat Jan 14 20:05:15 2017 +0530
> # Node ID 087be8a1c7a0452beee36ca23d7978d107b72315
> # Parent 9dc4d056d85a041b2b28587b3b84608b1f0903a5
> util: add length argument to util.buffer()
Queued, thanks.
> --- a/mercurial/util.py Sat Jan 14 01:23:07 2017 +0530
> +++ b/mercurial/util.py Sat Jan 14 20:05:15 2017 +0530
> @@ -238,10 +238,14 @@
> buffer = buffer
> except NameError:
> if not pycompat.ispy3:
> - def buffer(sliceable, offset=0):
> + def buffer(sliceable, offset=0, length=None):
> + if not length is None:
> + return sliceable[offset:offset + length]
> return sliceable[offset:]
> else:
> - def buffer(sliceable, offset=0):
> + def buffer(sliceable, offset=0, length=None):
> + if not length is None:
I've updated them to use "is not" operator, which seems more common.
More information about the Mercurial-devel
mailing list