Patchwork [1,of,8] formatter: more details on assertion failure

login
register
mail settings
Submitter Boris Feld
Date Oct. 11, 2018, 8:01 a.m.
Message ID <8eaff9311fa407d89854.1539244904@localhost.localdomain>
Download mbox | patch
Permalink /patch/35624/
State Accepted
Headers show

Comments

Boris Feld - Oct. 11, 2018, 8:01 a.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1538408273 -7200
#      Mon Oct 01 17:37:53 2018 +0200
# Node ID 8eaff9311fa407d89854d6e60938200939a0a506
# Parent  a66594c5fad422499bfaf669d182e02fe3c0be32
# EXP-Topic revlog-perf
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 8eaff9311fa4
formatter: more details on assertion failure

This is useful when the assertion fails.
Gregory Szorc - Oct. 11, 2018, 8:23 a.m.
On Thu, Oct 11, 2018 at 10:05 AM Boris Feld <boris.feld@octobus.net> wrote:

> # HG changeset patch
> # User Boris Feld <boris.feld@octobus.net>
> # Date 1538408273 -7200
> #      Mon Oct 01 17:37:53 2018 +0200
> # Node ID 8eaff9311fa407d89854d6e60938200939a0a506
> # Parent  a66594c5fad422499bfaf669d182e02fe3c0be32
> # EXP-Topic revlog-perf
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r
> 8eaff9311fa4
> formatter: more details on assertion failure
>

Queued parts 1-6. Still digesting part 7.


>
> This is useful when the assertion fails.
>
> diff --git a/mercurial/formatter.py b/mercurial/formatter.py
> --- a/mercurial/formatter.py
> +++ b/mercurial/formatter.py
> @@ -213,7 +213,7 @@ class baseformatter(object):
>      def write(self, fields, deftext, *fielddata, **opts):
>          '''do default text output while assigning data to item'''
>          fieldkeys = fields.split()
> -        assert len(fieldkeys) == len(fielddata)
> +        assert len(fieldkeys) == len(fielddata), (fieldkeys, fielddata)
>          self._item.update(zip(fieldkeys, fielddata))
>      def condwrite(self, cond, fields, deftext, *fielddata, **opts):
>          '''do conditional write (primarily for plain formatter)'''
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
Boris Feld - Oct. 17, 2018, 1:22 p.m.
On 11/10/2018 10:23, Gregory Szorc wrote:
> On Thu, Oct 11, 2018 at 10:05 AM Boris Feld <boris.feld@octobus.net
> <mailto:boris.feld@octobus.net>> wrote:
>
>     # HG changeset patch
>     # User Boris Feld <boris.feld@octobus.net
>     <mailto:boris.feld@octobus.net>>
>     # Date 1538408273 -7200
>     #      Mon Oct 01 17:37:53 2018 +0200
>     # Node ID 8eaff9311fa407d89854d6e60938200939a0a506
>     # Parent  a66594c5fad422499bfaf669d182e02fe3c0be32
>     # EXP-Topic revlog-perf
>     # Available At https://bitbucket.org/octobus/mercurial-devel/
>     #              hg pull
>     https://bitbucket.org/octobus/mercurial-devel/ -r 8eaff9311fa4
>     formatter: more details on assertion failure
>
>
> Queued parts 1-6. Still digesting part 7.
Is there anything we could do to helps the review process of part 7 and 8?
>  
>
>
>     This is useful when the assertion fails.
>
>     diff --git a/mercurial/formatter.py b/mercurial/formatter.py
>     --- a/mercurial/formatter.py
>     +++ b/mercurial/formatter.py
>     @@ -213,7 +213,7 @@ class baseformatter(object):
>          def write(self, fields, deftext, *fielddata, **opts):
>              '''do default text output while assigning data to item'''
>              fieldkeys = fields.split()
>     -        assert len(fieldkeys) == len(fielddata)
>     +        assert len(fieldkeys) == len(fielddata), (fieldkeys,
>     fielddata)
>              self._item.update(zip(fieldkeys, fielddata))
>          def condwrite(self, cond, fields, deftext, *fielddata, **opts):
>              '''do conditional write (primarily for plain formatter)'''
>     _______________________________________________
>     Mercurial-devel mailing list
>     Mercurial-devel@mercurial-scm.org
>     <mailto:Mercurial-devel@mercurial-scm.org>
>     https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
>
> _______________________________________________
> Mercurial-devel mailing list
> Mercurial-devel@mercurial-scm.org
> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
Gregory Szorc - Oct. 17, 2018, 1:26 p.m.
On Wed, Oct 17, 2018 at 3:22 PM Boris FELD <boris.feld@octobus.net> wrote:

> On 11/10/2018 10:23, Gregory Szorc wrote:
>
> On Thu, Oct 11, 2018 at 10:05 AM Boris Feld <boris.feld@octobus.net>
> wrote:
>
>> # HG changeset patch
>> # User Boris Feld <boris.feld@octobus.net>
>> # Date 1538408273 -7200
>> #      Mon Oct 01 17:37:53 2018 +0200
>> # Node ID 8eaff9311fa407d89854d6e60938200939a0a506
>> # Parent  a66594c5fad422499bfaf669d182e02fe3c0be32
>> # EXP-Topic revlog-perf
>> # Available At https://bitbucket.org/octobus/mercurial-devel/
>> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r
>> 8eaff9311fa4
>> formatter: more details on assertion failure
>>
>
> Queued parts 1-6. Still digesting part 7.
>
> Is there anything we could do to helps the review process of part 7 and 8?
>

Please resend the patches.


>
>
>>
>> This is useful when the assertion fails.
>>
>> diff --git a/mercurial/formatter.py b/mercurial/formatter.py
>> --- a/mercurial/formatter.py
>> +++ b/mercurial/formatter.py
>> @@ -213,7 +213,7 @@ class baseformatter(object):
>>      def write(self, fields, deftext, *fielddata, **opts):
>>          '''do default text output while assigning data to item'''
>>          fieldkeys = fields.split()
>> -        assert len(fieldkeys) == len(fielddata)
>> +        assert len(fieldkeys) == len(fielddata), (fieldkeys, fielddata)
>>          self._item.update(zip(fieldkeys, fielddata))
>>      def condwrite(self, cond, fields, deftext, *fielddata, **opts):
>>          '''do conditional write (primarily for plain formatter)'''
>> _______________________________________________
>> Mercurial-devel mailing list
>> Mercurial-devel@mercurial-scm.org
>> https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>>
>
> _______________________________________________
> Mercurial-devel mailing listMercurial-devel@mercurial-scm.orghttps://www.mercurial-scm.org/mailman/listinfo/mercurial-devel
>
>

Patch

diff --git a/mercurial/formatter.py b/mercurial/formatter.py
--- a/mercurial/formatter.py
+++ b/mercurial/formatter.py
@@ -213,7 +213,7 @@  class baseformatter(object):
     def write(self, fields, deftext, *fielddata, **opts):
         '''do default text output while assigning data to item'''
         fieldkeys = fields.split()
-        assert len(fieldkeys) == len(fielddata)
+        assert len(fieldkeys) == len(fielddata), (fieldkeys, fielddata)
         self._item.update(zip(fieldkeys, fielddata))
     def condwrite(self, cond, fields, deftext, *fielddata, **opts):
         '''do conditional write (primarily for plain formatter)'''