[PATCH remotenames-ext] namespace: never return None for nodes query

Sean Farley sean at farley.io
Wed Jun 7 19:41:17 EDT 2017


Durham Goode <durham at fb.com> writes:

> # HG changeset patch
> # User Durham Goode <durham at fb.com>
> # Date 1496773892 25200
> #      Tue Jun 06 11:31:32 2017 -0700
> # Node ID 2e45bcb8483880d79f370ab0e703e72d900d450c
> # Parent  55a7fc62fc84a0d9e6996c69f35493d0fcd6bd41
> namespace: never return None for nodes query
>
> Previously we would return None if the given name didn't have any nodes
> associated with it. This causes problems in a number of places that assume the
> return value is always a list. For instance, core calls sorted on the result
> without checking if it's None, and the remotenames code itself tries to access
> the nodes via [0] without checking if there were any actual nodes.
>
> In remotenames, this can occur if a name exists that has an non-existent node.
> If remotenames.resolvenodes is False (for performance reasons) then we will see
> the name, but the node list will resolve to no nodes. This patch avoids
> returning None and makes the 0 index access check if there are any nodes first.

Ah, makes sense; thanks for the patch! Queued
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 800 bytes
Desc: not available
URL: <http://www.mercurial-scm.org/pipermail/mercurial-devel/attachments/20170607/9801b40d/attachment.sig>


More information about the Mercurial-devel mailing list