[PATCH 4 of 4] revset: no longer silently filter out invalid revision in _intlist (API) (BC)

Yuya Nishihara yuya at tcha.org
Fri Jan 25 09:08:26 EST 2019


On Fri, 18 Jan 2019 16:53:19 +0100, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld <boris.feld at octobus.net>
> # Date 1547826690 -3600
> #      Fri Jan 18 16:51:30 2019 +0100
> # Node ID 43543a826aab4e6495694f84e9197b903a7cbf10
> # Parent  aa032edd96aeb34f8d220b11fbdbd08a9497cbc9
> # EXP-Topic intlist
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r 43543a826aab
> revset: no longer silently filter out invalid revision in _intlist (API) (BC)
>
> This change makes the fastpath (fullrepo case) evaluated first, so invalid
> revision in the _intlist() entries will be simply forwarded to the lower layer
> in this case. This is similar to what 'rawsmartet' does in the case where
> "%ld" did not get serialized.
> 
> Further processing of the resulting smartset is likely to raise an error
> because of the filtering.

Well, I think it could lead to crash because revlog may raise IndexError
for example. Unlike the fastpath smartset, users can pass in any integers
to %ld, so the situation is different.

> It would be possible to strictly check for any invalid entry in the input
> revs, but we have not decided on doing this yet.
> 
> This series focuses on having a consistent behavior for %d and %ld in all
> cases.
> 
> diff --git a/mercurial/revset.py b/mercurial/revset.py
> --- a/mercurial/revset.py
> +++ b/mercurial/revset.py
> @@ -2179,7 +2179,7 @@ def _orderedlist(repo, subset, x):
>          for r in revs:
>              if r in seen:
>                  continue
> -            if (r in subset or full and (r == nullrev or r == wdirrev)):
> +            if (full and (r == nullrev or r == wdirrev)) or r in subset:

Maybe you wanted to remove 'and (r == nullrev or r == wdirrev)'?

Anyway, this is the function for '%ls'. You'll need to update the _intlist()
function.


More information about the Mercurial-devel mailing list