Patchwork hideablerevs: expand docstring to warn about possible traps

login
register
mail settings
Submitter Pierre-Yves David
Date April 4, 2016, 8:31 a.m.
Message ID <427e15efaa1cb7c249e4.1459758678@marginatus.alto.octopoid.net>
Download mbox | patch
Permalink /patch/14357/
State Accepted
Headers show

Comments

Pierre-Yves David - April 4, 2016, 8:31 a.m.
# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@fb.com>
# Date 1459637807 25200
#      Sat Apr 02 15:56:47 2016 -0700
# Node ID 427e15efaa1cb7c249e4305b6ebb29aeede62f99
# Parent  cb235ffd29c42a2f449f78a6f8c049bcf84a997f
# Available At http://mercurial-scm.org/repo/users/marmoute/mercurial/
#              hg pull http://mercurial-scm.org/repo/users/marmoute/mercurial/ -r 427e15efaa1c
# EXP-Topic branchmap
hideablerevs: expand docstring to warn about possible traps

Sean Farley just wasted multiple hours trying to figure out why his code was
crashing. We update the docstring to make the constraint clearer.
timeless - April 4, 2016, 6:37 p.m.
Pierre-Yves David wrote:
> +    This is a standalone function to help extensions to wrap it.

Help-> enable

> +    lead to crashs."""

Crashes
Martijn Pieters - April 4, 2016, 9:18 p.m.
On 4 April 2016 at 09:31, Pierre-Yves David
<pierre-yves.david@ens-lyon.org> wrote:
       """Revisions candidates to be hidden

> +    This is a standalone function to help extensions to wrap it.
> +
> +    Because we use the set of immutable changeset as a fallback subset in
> +    branchmap (see mercurial.branchmap.subsettable), You cannot set "public"
> +    changesets as "hideable". Doing so would break multiple code assertions and
> +    lead to crashs."""

Edited for spelling / grammar:

"""
Revision candidates to be hidden

This is a standalone function to allow extensions to wrap it.

Because we use the set of immutable changesets as a fallback subset in
branchmap (see mercurial.branchmap.subsettable), you cannot set "public"
changesets as "hideable". Doing so would break multiple code assertions and
lead to crashes.

"""
timeless - April 4, 2016, 10:34 p.m.
lgtm

On Mon, Apr 4, 2016 at 5:18 PM, Martijn Pieters <mj@zopatista.com> wrote:
> On 4 April 2016 at 09:31, Pierre-Yves David
> <pierre-yves.david@ens-lyon.org> wrote:
>        """Revisions candidates to be hidden
>
>> +    This is a standalone function to help extensions to wrap it.
>> +
>> +    Because we use the set of immutable changeset as a fallback subset in
>> +    branchmap (see mercurial.branchmap.subsettable), You cannot set "public"
>> +    changesets as "hideable". Doing so would break multiple code assertions and
>> +    lead to crashs."""
>
> Edited for spelling / grammar:
>
> """
> Revision candidates to be hidden
>
> This is a standalone function to allow extensions to wrap it.
>
> Because we use the set of immutable changesets as a fallback subset in
> branchmap (see mercurial.branchmap.subsettable), you cannot set "public"
> changesets as "hideable". Doing so would break multiple code assertions and
> lead to crashes.
>
> """
>
> --
> Martijn Pieters
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Pierre-Yves David - April 4, 2016, 10:44 p.m.
On 04/04/2016 03:34 PM, timeless wrote:
> lgtm
>
> On Mon, Apr 4, 2016 at 5:18 PM, Martijn Pieters <mj@zopatista.com> wrote:
>> On 4 April 2016 at 09:31, Pierre-Yves David
>> <pierre-yves.david@ens-lyon.org> wrote:
>>         """Revisions candidates to be hidden
>>
>>> +    This is a standalone function to help extensions to wrap it.
>>> +
>>> +    Because we use the set of immutable changeset as a fallback subset in
>>> +    branchmap (see mercurial.branchmap.subsettable), You cannot set "public"
>>> +    changesets as "hideable". Doing so would break multiple code assertions and
>>> +    lead to crashs."""
>>
>> Edited for spelling / grammar:
>>
>> """
>> Revision candidates to be hidden
>>
>> This is a standalone function to allow extensions to wrap it.
>>
>> Because we use the set of immutable changesets as a fallback subset in
>> branchmap (see mercurial.branchmap.subsettable), you cannot set "public"
>> changesets as "hideable". Doing so would break multiple code assertions and
>> lead to crashes.
>>
>> """

I've pushed that version. Thanks for the help.\
Sean Farley - April 7, 2016, 10:46 p.m.
Pierre-Yves David <pierre-yves.david@ens-lyon.org> writes:

> On 04/04/2016 03:34 PM, timeless wrote:
>> lgtm
>>
>> On Mon, Apr 4, 2016 at 5:18 PM, Martijn Pieters <mj@zopatista.com> wrote:
>>> On 4 April 2016 at 09:31, Pierre-Yves David
>>> <pierre-yves.david@ens-lyon.org> wrote:
>>>         """Revisions candidates to be hidden
>>>
>>>> +    This is a standalone function to help extensions to wrap it.
>>>> +
>>>> +    Because we use the set of immutable changeset as a fallback subset in
>>>> +    branchmap (see mercurial.branchmap.subsettable), You cannot set "public"
>>>> +    changesets as "hideable". Doing so would break multiple code assertions and
>>>> +    lead to crashs."""
>>>
>>> Edited for spelling / grammar:
>>>
>>> """
>>> Revision candidates to be hidden
>>>
>>> This is a standalone function to allow extensions to wrap it.
>>>
>>> Because we use the set of immutable changesets as a fallback subset in
>>> branchmap (see mercurial.branchmap.subsettable), you cannot set "public"
>>> changesets as "hideable". Doing so would break multiple code assertions and
>>> lead to crashes.
>>>
>>> """
>
> I've pushed that version. Thanks for the help.\

Future me is so, so happy

Patch

diff --git a/mercurial/repoview.py b/mercurial/repoview.py
--- a/mercurial/repoview.py
+++ b/mercurial/repoview.py
@@ -27,11 +27,16 @@  except NameError:
     xrange = range
 
 def hideablerevs(repo):
     """Revisions candidates to be hidden
 
-    This is a standalone function to help extensions to wrap it."""
+    This is a standalone function to help extensions to wrap it.
+
+    Because we use the set of immutable changeset as a fallback subset in
+    branchmap (see mercurial.branchmap.subsettable), You cannot set "public"
+    changesets as "hideable". Doing so would break multiple code assertions and
+    lead to crashs."""
     return obsolete.getrevs(repo, 'obsolete')
 
 def _getstatichidden(repo):
     """Revision to be hidden (disregarding dynamic blocker)