Patchwork [2,of,2,V2] statichttprepo.httprangeheader: implement readlines

login
register
mail settings
Submitter Siddharth Agarwal
Date Nov. 17, 2013, 9:41 p.m.
Message ID <81d00175c0a2cac7d378.1384724503@dev1091.prn1.facebook.com>
Download mbox | patch
Permalink /patch/3047/
State Accepted
Headers show

Comments

Siddharth Agarwal - Nov. 17, 2013, 9:41 p.m.
# HG changeset patch
# User Siddharth Agarwal <sid0@fb.com>
# Date 1384723878 28800
#      Sun Nov 17 13:31:18 2013 -0800
# Node ID 81d00175c0a2cac7d3783b86e7740d58dea9c248
# Parent  e1ef7723bb1da674a1a85cc872437735e8f4b08e
statichttprepo.httprangeheader: implement readlines

bookmarks.readcurrent() requires readlines() on file objects returned from
repo.vfs. It isn't used right now but will be in upcoming patches.
Augie Fackler - Nov. 17, 2013, 9:52 p.m.
On Sun, Nov 17, 2013 at 01:41:43PM -0800, Siddharth Agarwal wrote:
> # HG changeset patch
> # User Siddharth Agarwal <sid0@fb.com>
> # Date 1384723878 28800
> #      Sun Nov 17 13:31:18 2013 -0800
> # Node ID 81d00175c0a2cac7d3783b86e7740d58dea9c248
> # Parent  e1ef7723bb1da674a1a85cc872437735e8f4b08e
> statichttprepo.httprangeheader: implement readlines

queued these, thanks

>
> bookmarks.readcurrent() requires readlines() on file objects returned from
> repo.vfs. It isn't used right now but will be in upcoming patches.
>
> diff --git a/mercurial/statichttprepo.py b/mercurial/statichttprepo.py
> --- a/mercurial/statichttprepo.py
> +++ b/mercurial/statichttprepo.py
> @@ -54,8 +54,10 @@
>              data = data[:bytes]
>          self.pos += len(data)
>          return data
> +    def readlines(self):
> +        return self.read().splitlines(True)
>      def __iter__(self):
> -        return iter(self.read().splitlines(True))
> +        return iter(self.readlines())
>      def close(self):
>          pass
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/statichttprepo.py b/mercurial/statichttprepo.py
--- a/mercurial/statichttprepo.py
+++ b/mercurial/statichttprepo.py
@@ -54,8 +54,10 @@ 
             data = data[:bytes]
         self.pos += len(data)
         return data
+    def readlines(self):
+        return self.read().splitlines(True)
     def __iter__(self):
-        return iter(self.read().splitlines(True))
+        return iter(self.readlines())
     def close(self):
         pass