Patchwork [in-crew] manifest: document return type of readfast()

login
register
mail settings
Submitter Augie Fackler
Date May 5, 2015, 2:53 p.m.
Message ID <a9bca07c5df4834db6f6.1430837617@arthedain.pit.corp.google.com>
Download mbox | patch
Permalink /patch/8893/
State Accepted
Commit a9bca07c5df4834db6f62921ffcad3d88c4d1572
Headers show

Comments

Augie Fackler - May 5, 2015, 2:53 p.m.
# HG changeset patch
# User Augie Fackler <augie@google.com>
# Date 1430238690 14400
#      Tue Apr 28 12:31:30 2015 -0400
# Node ID a9bca07c5df4834db6f62921ffcad3d88c4d1572
# Parent  e5b507efb36e2b9ad8edb1a38459d26c934d74dd
manifest: document return type of readfast()

I keep having to ponder out what readfast() means, and it always
surprises me. Document the return type in the docstring so that future
readers won't have to puzzle this out again.
Augie Fackler - May 5, 2015, 2:55 p.m.
Martin and I (I think) wrote this while I was in CA last week, and
since it's just a docstring cleanup I've pushed it to crew, and am
copying the list for completeness.

On Tue, May 5, 2015 at 10:53 AM, Augie Fackler <raf@durin42.com> wrote:
> # HG changeset patch
> # User Augie Fackler <augie@google.com>
> # Date 1430238690 14400
> #      Tue Apr 28 12:31:30 2015 -0400
> # Node ID a9bca07c5df4834db6f62921ffcad3d88c4d1572
> # Parent  e5b507efb36e2b9ad8edb1a38459d26c934d74dd
> manifest: document return type of readfast()
>
> I keep having to ponder out what readfast() means, and it always
> surprises me. Document the return type in the docstring so that future
> readers won't have to puzzle this out again.
>
> diff --git a/mercurial/manifest.py b/mercurial/manifest.py
> --- a/mercurial/manifest.py
> +++ b/mercurial/manifest.py
> @@ -793,7 +793,13 @@ class manifest(revlog.revlog):
>          return self._newmanifest(d)
>
>      def readfast(self, node):
> -        '''use the faster of readdelta or read'''
> +        '''use the faster of readdelta or read
> +
> +        This will return a manifest which is either only the files
> +        added/modified relative to p1, or all files in the
> +        manifest. Which one is returned depends on the codepath used
> +        to retrieve the data.
> +        '''
>          r = self.rev(node)
>          deltaparent = self.deltaparent(r)
>          if deltaparent != revlog.nullrev and deltaparent in self.parentrevs(r):
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@selenic.com
> http://selenic.com/mailman/listinfo/mercurial-devel

Patch

diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -793,7 +793,13 @@  class manifest(revlog.revlog):
         return self._newmanifest(d)
 
     def readfast(self, node):
-        '''use the faster of readdelta or read'''
+        '''use the faster of readdelta or read
+
+        This will return a manifest which is either only the files
+        added/modified relative to p1, or all files in the
+        manifest. Which one is returned depends on the codepath used
+        to retrieve the data.
+        '''
         r = self.rev(node)
         deltaparent = self.deltaparent(r)
         if deltaparent != revlog.nullrev and deltaparent in self.parentrevs(r):