Patchwork [3,of,4] revset: add wdir support to _intlist

login
register
mail settings
Submitter Boris Feld
Date Jan. 18, 2019, 3:53 p.m.
Message ID <aa032edd96aeb34f8d22.1547826798@localhost.localdomain>
Download mbox | patch
Permalink /patch/37877/
State Accepted
Headers show

Comments

Boris Feld - Jan. 18, 2019, 3:53 p.m.
# HG changeset patch
# User Boris Feld <boris.feld@octobus.net>
# Date 1547826678 -3600
#      Fri Jan 18 16:51:18 2019 +0100
# Node ID aa032edd96aeb34f8d220b11fbdbd08a9497cbc9
# Parent  35c9dec1849f6a41f87fdc130798387376bb8345
# EXP-Topic intlist
# Available At https://bitbucket.org/octobus/mercurial-devel/
#              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r aa032edd96ae
revset: add wdir support to _intlist

The previous changeset made it clear that we did not supported the wdirrev in
_intlist. So we fix it.
Yuya Nishihara - Jan. 25, 2019, 1:21 p.m.
On Fri, 18 Jan 2019 16:53:18 +0100, Boris Feld wrote:
> # HG changeset patch
> # User Boris Feld <boris.feld@octobus.net>
> # Date 1547826678 -3600
> #      Fri Jan 18 16:51:18 2019 +0100
> # Node ID aa032edd96aeb34f8d220b11fbdbd08a9497cbc9
> # Parent  35c9dec1849f6a41f87fdc130798387376bb8345
> # EXP-Topic intlist
> # Available At https://bitbucket.org/octobus/mercurial-devel/
> #              hg pull https://bitbucket.org/octobus/mercurial-devel/ -r aa032edd96ae
> revset: add wdir support to _intlist
> 
> The previous changeset made it clear that we did not supported the wdirrev in
> _intlist. So we fix it.
> 
> diff --git a/mercurial/revset.py b/mercurial/revset.py
> --- a/mercurial/revset.py
> +++ b/mercurial/revset.py
> @@ -2174,11 +2174,12 @@ def _orderedlist(repo, subset, x):
>  
>          full = isinstance(subset, fullreposet)
>          nullrev = node.nullrev
> +        wdirrev = node.wdirrev
>  
>          for r in revs:
>              if r in seen:
>                  continue
> -            if (r in subset or full and r == nullrev):
> +            if (r in subset or full and (r == nullrev or r == wdirrev)):

So this is the _list() function used for '%ls' or 'x + y + ...' expression,
where wdir revision will never appear since it can't be a valid symbol/string
as of now. It's somewhat consistent how stringset() ignores wdirrev/node.

Patch

diff --git a/mercurial/revset.py b/mercurial/revset.py
--- a/mercurial/revset.py
+++ b/mercurial/revset.py
@@ -2174,11 +2174,12 @@  def _orderedlist(repo, subset, x):
 
         full = isinstance(subset, fullreposet)
         nullrev = node.nullrev
+        wdirrev = node.wdirrev
 
         for r in revs:
             if r in seen:
                 continue
-            if (r in subset or full and r == nullrev):
+            if (r in subset or full and (r == nullrev or r == wdirrev)):
                 ls.append(r)
             seen.add(r)
     return baseset(ls)